Class: WIP::Runner::Shell::Task
- Inherits:
-
Object
- Object
- WIP::Runner::Shell::Task
- Defined in:
- lib/wip/runner/shell/task.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#configs ⇒ Object
readonly
Returns the value of attribute configs.
-
#shells ⇒ Object
readonly
Returns the value of attribute shells.
Instance Method Summary collapse
- #build(arguments, options) ⇒ Object
- #config(term, options = {}) ⇒ Object
-
#initialize(command, &block) ⇒ Task
constructor
A new instance of Task.
- #shell(handler, content, &block) ⇒ Object
- #task(&block) ⇒ Object
Constructor Details
#initialize(command, &block) ⇒ Task
Returns a new instance of Task.
7 8 9 10 11 12 13 |
# File 'lib/wip/runner/shell/task.rb', line 7 def initialize(command, &block) @command = command @configs = [] @shells = [] @children = [] @block = block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object (protected)
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/wip/runner/shell/task.rb', line 33 def method_missing(method_name, *args, &block) if @command.respond_to?(method_name) @command.send(method_name, *args, &block) else # super @command.instance_eval { method_missing(method_name, *args, &block) } end end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
5 6 7 |
# File 'lib/wip/runner/shell/task.rb', line 5 def children @children end |
#configs ⇒ Object (readonly)
Returns the value of attribute configs.
5 6 7 |
# File 'lib/wip/runner/shell/task.rb', line 5 def configs @configs end |
#shells ⇒ Object (readonly)
Returns the value of attribute shells.
5 6 7 |
# File 'lib/wip/runner/shell/task.rb', line 5 def shells @shells end |
Instance Method Details
#build(arguments, options) ⇒ Object
15 16 17 |
# File 'lib/wip/runner/shell/task.rb', line 15 def build(arguments, ) self.instance_exec(arguments, , &@block) ; self end |
#config(term, options = {}) ⇒ Object
19 20 21 |
# File 'lib/wip/runner/shell/task.rb', line 19 def config(term, = {}) @configs << [term.to_s, ] # Config.new(...) end |
#shell(handler, content, &block) ⇒ Object
23 24 25 |
# File 'lib/wip/runner/shell/task.rb', line 23 def shell(handler, content, &block) shells << Handlers.locate(handler).new(content, &block) end |
#task(&block) ⇒ Object
27 28 29 |
# File 'lib/wip/runner/shell/task.rb', line 27 def task(&block) children << Task.new(@command, &block) end |