Class: Fire::Task
- Inherits:
-
Object
- Object
- Fire::Task
- Defined in:
- lib/fire/task.rb
Overview
The Task class encapsulates command-line dependent rules.
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Task description.
-
#name ⇒ Object
readonly
The tasks name.
-
#requisite ⇒ Object
(also: #todo)
readonly
Returns the value of attribute requisite.
Instance Method Summary collapse
- #call ⇒ Object protected
-
#initialize(name, options = {}, &procedure) ⇒ Task
constructor
A new instance of Task.
-
#invoke(&prepare) ⇒ Object
(also: #apply)
Run the task.
Constructor Details
#initialize(name, options = {}, &procedure) ⇒ Task
Returns a new instance of Task.
7 8 9 10 11 12 13 14 |
# File 'lib/fire/task.rb', line 7 def initialize(name, ={}, &procedure) @name = name @description = [:desc] @requisite = [:todo] || [] @procedure = procedure #@_reducing = nil end |
Instance Attribute Details
#description ⇒ Object (readonly)
Task description. This is need for a task to available via the command line.
21 22 23 |
# File 'lib/fire/task.rb', line 21 def description @description end |
#name ⇒ Object (readonly)
The tasks name.
17 18 19 |
# File 'lib/fire/task.rb', line 17 def name @name end |
#requisite ⇒ Object (readonly) Also known as: todo
Returns the value of attribute requisite.
24 25 26 |
# File 'lib/fire/task.rb', line 24 def requisite @requisite end |
Instance Method Details
#call ⇒ Object (protected)
45 46 47 |
# File 'lib/fire/task.rb', line 45 def call @procedure.call end |
#invoke(&prepare) ⇒ Object Also known as: apply
Run the task.
30 31 32 33 |
# File 'lib/fire/task.rb', line 30 def invoke(&prepare) prepare.call call end |