Class: RgGen::Core::Builder::PluginSpec
- Defined in:
- lib/rggen/core/builder/plugin_spec.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #activate(builder) ⇒ Object
- #activate_additionally(builder) ⇒ Object
- #addtional_setup(&body) ⇒ Object
-
#initialize(name) ⇒ PluginSpec
constructor
A new instance of PluginSpec.
- #register_component(component, layers = nil, &body) ⇒ Object
- #register_files(files) ⇒ Object (also: #files)
- #setup_loader(component, loader_type, &body) ⇒ Object
- #version(value = nil) ⇒ Object
- #version_info ⇒ Object
Constructor Details
#initialize(name) ⇒ PluginSpec
Returns a new instance of PluginSpec.
7 8 9 10 11 12 13 |
# File 'lib/rggen/core/builder/plugin_spec.rb', line 7 def initialize(name) @name = name @component_registrations = [] @loader_registrations = [] @files = [] block_given? && yield(self) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
15 16 17 |
# File 'lib/rggen/core/builder/plugin_spec.rb', line 15 def name @name end |
Instance Method Details
#activate(builder) ⇒ Object
45 46 47 48 49 |
# File 'lib/rggen/core/builder/plugin_spec.rb', line 45 def activate(builder) activate_components(builder) activate_loaders(builder) load_files end |
#activate_additionally(builder) ⇒ Object
51 52 53 |
# File 'lib/rggen/core/builder/plugin_spec.rb', line 51 def activate_additionally(builder) @addtional_setup&.call(builder) end |
#addtional_setup(&body) ⇒ Object
41 42 43 |
# File 'lib/rggen/core/builder/plugin_spec.rb', line 41 def addtional_setup(&body) @addtional_setup = body end |
#register_component(component, layers = nil, &body) ⇒ Object
26 27 28 |
# File 'lib/rggen/core/builder/plugin_spec.rb', line 26 def register_component(component, layers = nil, &body) @component_registrations << [component, layers, body] end |
#register_files(files) ⇒ Object Also known as: files
34 35 36 37 |
# File 'lib/rggen/core/builder/plugin_spec.rb', line 34 def register_files(files) root = File.dirname(caller_locations(1, 1).first.path) files.each { |file| @files << File.join(root, file) } end |
#setup_loader(component, loader_type, &body) ⇒ Object
30 31 32 |
# File 'lib/rggen/core/builder/plugin_spec.rb', line 30 def setup_loader(component, loader_type, &body) @loader_registrations << [component, loader_type, body] end |
#version(value = nil) ⇒ Object
17 18 19 20 |
# File 'lib/rggen/core/builder/plugin_spec.rb', line 17 def version(value = nil) @version = value if value version_value end |
#version_info ⇒ Object
22 23 24 |
# File 'lib/rggen/core/builder/plugin_spec.rb', line 22 def version_info "#{@name} #{version}" end |