Class: WIP::Runner::Shell::Task
- Inherits:
-
Object
- Object
- WIP::Runner::Shell::Task
- Defined in:
- lib/wip/runner/shell/task.rb
Instance Attribute Summary collapse
-
#configs ⇒ Object
readonly
Returns the value of attribute configs.
-
#heading ⇒ Object
readonly
Returns the value of attribute heading.
-
#shells ⇒ Object
readonly
Returns the value of attribute shells.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
Instance Method Summary collapse
- #build(arguments, options) ⇒ Object
- #config(term, options = {}, &block) ⇒ Object
- #heading? ⇒ Boolean
-
#initialize(command, *args, &block) ⇒ Task
constructor
A new instance of Task.
- #shell(handler, content, &block) ⇒ Object
- #task(*args, &block) ⇒ Object
Constructor Details
#initialize(command, *args, &block) ⇒ Task
Returns a new instance of Task.
7 8 9 10 11 12 13 14 |
# File 'lib/wip/runner/shell/task.rb', line 7 def initialize(command, *args, &block) @command = command @configs = [] @shells = [] @steps = [] @heading = args.first unless args.empty? @block = block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object (protected)
38 39 40 41 42 43 44 45 46 |
# File 'lib/wip/runner/shell/task.rb', line 38 def method_missing(method_name, *args, &block) if @command.respond_to?(method_name) @command.send(method_name, *args, &block) else @command.instance_eval { method_missing(method_name, *args, &block) } end end |
Instance Attribute Details
#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 |
#heading ⇒ Object (readonly)
Returns the value of attribute heading.
5 6 7 |
# File 'lib/wip/runner/shell/task.rb', line 5 def heading @heading 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 |
#steps ⇒ Object (readonly)
Returns the value of attribute steps.
5 6 7 |
# File 'lib/wip/runner/shell/task.rb', line 5 def steps @steps end |
Instance Method Details
#build(arguments, options) ⇒ Object
16 17 18 |
# File 'lib/wip/runner/shell/task.rb', line 16 def build(arguments, ) self.instance_exec(arguments, , &@block) ; self end |
#config(term, options = {}, &block) ⇒ Object
24 25 26 |
# File 'lib/wip/runner/shell/task.rb', line 24 def config(term, = {}, &block) @configs << [term.to_s, , block] # Config.new(...) end |
#heading? ⇒ Boolean
20 21 22 |
# File 'lib/wip/runner/shell/task.rb', line 20 def heading? !! @heading end |