Class: Really::Task
Instance Attribute Summary collapse
-
#dependencies ⇒ Object
Returns the value of attribute dependencies.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#commands ⇒ Object
Internal public API.
- #eql?(task) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(name, options = {}, &block) ⇒ Task
constructor
A new instance of Task.
- #to_s ⇒ Object
Constructor Details
#initialize(name, options = {}, &block) ⇒ Task
Returns a new instance of Task.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/really/task.rb', line 9 def initialize(name, = {}, &block) @name = name @options = @block = block @dependencies = [] @commands = [] dependencies = [:depends_on] || [] @dependencies += [dependencies].flatten end |
Instance Attribute Details
#dependencies ⇒ Object
Returns the value of attribute dependencies.
7 8 9 |
# File 'lib/really/task.rb', line 7 def dependencies @dependencies end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/really/task.rb', line 6 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/really/task.rb', line 7 def @options end |
Instance Method Details
#commands ⇒ Object
Internal public API
34 35 36 37 |
# File 'lib/really/task.rb', line 34 def commands instance_eval &@block if @block && @commands.empty? @commands end |
#eql?(task) ⇒ Boolean
20 21 22 |
# File 'lib/really/task.rb', line 20 def eql?(task) @name == task.name end |
#hash ⇒ Object
24 25 26 |
# File 'lib/really/task.rb', line 24 def hash @name.hash end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/really/task.rb', line 28 def to_s "<#{self.class} #{@name}>" end |