Class: Ruber::PluginSpecification

Inherits:
OpenStruct show all
Defined in:
lib/ruber/plugin_specification.rb

Defined Under Namespace

Classes: PSFError

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (PluginSpecification) initialize(arg, dir = nil)

A new instance of PluginSpecification



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/ruber/plugin_specification.rb', line 47

def initialize arg, dir = nil
  super()
  @directory = if dir then dir
  elsif arg.is_a? String then File.dirname arg
  else File.expand_path Dir.pwd
  end
  @intro_only = true
  @reader = PluginSpecificationReader.new self
  @data = arg.is_a?(Hash) ? arg : YAML.load( File.read(arg) )
  @reader.process_pdf_intro @data
end

Instance Attribute Details

- (Object) directory (readonly)

Returns the value of attribute directory



46
47
48
# File 'lib/ruber/plugin_specification.rb', line 46

def directory
  @directory
end

Class Method Details

+ (Object) full(file, dir = nil)



40
41
42
43
44
# File 'lib/ruber/plugin_specification.rb', line 40

def self.full file, dir = nil
  res = self.new file, dir
  res.complete_processing
  res
end

Instance Method Details

- (Object) complete_processing



99
100
101
102
# File 'lib/ruber/plugin_specification.rb', line 99

def complete_processing
  @reader.process_pdf @data
  @intro_only = false
end

- (Boolean) has_config_options?

Returns:

  • (Boolean)


63
64
65
66
67
# File 'lib/ruber/plugin_specification.rb', line 63

def has_config_options?
  raise "Ruber::PluginSpecification#has_config_options? can only be called on a full "\
      "Ruber::PluginSpecification" if @intro_only
  !config_options.empty?
end

- (Boolean) has_config_widgets?

Returns:

  • (Boolean)


75
76
77
78
79
# File 'lib/ruber/plugin_specification.rb', line 75

def has_config_widgets?
  raise "Ruber::PluginSpecification#has_config_widgets? can only be called on a full "\
      "Ruber::PluginSpecification" if @intro_only
  !config_widgets.empty?
end

- (Boolean) has_extensions?

Returns:

  • (Boolean)


93
94
95
96
97
# File 'lib/ruber/plugin_specification.rb', line 93

def has_extensions?
  raise "Ruber::PluginSpecification#has_extensions? can only be called on a full "\
      "Ruber::PluginSpecification" if @intro_only
  !extensions.empty?
end

- (Boolean) has_project_options?

Returns:

  • (Boolean)


81
82
83
84
85
# File 'lib/ruber/plugin_specification.rb', line 81

def has_project_options?
  raise "Ruber::PluginSpecification#has_project_options? can only be called on a full "\
      "Ruber::PluginSpecification" if @intro_only
  !project_options.empty?
end

- (Boolean) has_project_widgets?

Returns:

  • (Boolean)


87
88
89
90
91
# File 'lib/ruber/plugin_specification.rb', line 87

def has_project_widgets?
  raise "Ruber::PluginSpecification#has_project_widgets? can only be called on a full "\
      "Ruber::PluginSpecification" if @intro_only
  !project_widgets.empty?
end

- (Boolean) has_tool_widgets?

Returns:

  • (Boolean)


69
70
71
72
73
# File 'lib/ruber/plugin_specification.rb', line 69

def has_tool_widgets?
  raise "Ruber::PluginSpecification#has_tool_widgets? can only be called on a full "\
      "Ruber::PluginSpecification" if @intro_only
  !tool_widgets.empty?
end

- (Boolean) intro_only?

Returns:

  • (Boolean)


59
60
61
# File 'lib/ruber/plugin_specification.rb', line 59

def intro_only?
  @intro_only
end