Class: Baha::PreBuild::Module
- Inherits:
-
Object
- Object
- Baha::PreBuild::Module
- Defined in:
- lib/baha/pre_build.rb
Defined Under Namespace
Classes: Command, Download, Template
Constant Summary collapse
- @@modules =
[]
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(task) ⇒ Module
constructor
A new instance of Module.
Constructor Details
#initialize(task) ⇒ Module
Returns a new instance of Module.
36 37 38 39 40 |
# File 'lib/baha/pre_build.rb', line 36 def initialize(task) @config = task.delete(:config) @image = task.delete(:image) @args = task end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
34 35 36 |
# File 'lib/baha/pre_build.rb', line 34 def args @args end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
34 35 36 |
# File 'lib/baha/pre_build.rb', line 34 def config @config end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
34 35 36 |
# File 'lib/baha/pre_build.rb', line 34 def image @image end |
Class Method Details
.execute(task) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/baha/pre_build.rb', line 21 def execute(task) @@modules.each do |mod| if task.has_key?(mod.to_s) LOG.info { "Executing module #{mod}" } method = "module_#{mod}".intern self.send(method, Module.new(task)) return end end raise ModuleNotFoundError.new(task) end |
.register(name, options = {}, &block) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/baha/pre_build.rb', line 14 def register(name, = {}, &block) LOG.debug { "register module #{name} (#{.inspect})" } @@modules << name name = name.intern send(:define_singleton_method,"module_#{name}",&block) end |