Class: RakeFlowVisualizer::Task
- Inherits:
-
Object
- Object
- RakeFlowVisualizer::Task
- Defined in:
- lib/rake_flow_visualizer/task.rb
Instance Attribute Summary collapse
-
#dependencies ⇒ Object
readonly
Returns the value of attribute dependencies.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name) ⇒ Task
constructor
A new instance of Task.
- #to_s ⇒ Object
Constructor Details
#initialize(name) ⇒ Task
Returns a new instance of Task.
22 23 24 25 |
# File 'lib/rake_flow_visualizer/task.rb', line 22 def initialize(name) @name = name @dependencies = [] end |
Instance Attribute Details
#dependencies ⇒ Object (readonly)
Returns the value of attribute dependencies.
20 21 22 |
# File 'lib/rake_flow_visualizer/task.rb', line 20 def dependencies @dependencies end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
20 21 22 |
# File 'lib/rake_flow_visualizer/task.rb', line 20 def name @name end |
Class Method Details
.all ⇒ Object
16 17 18 |
# File 'lib/rake_flow_visualizer/task.rb', line 16 def self.all @tasks ||= [] end |
.find_or_create(name) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/rake_flow_visualizer/task.rb', line 4 def self.find_or_create(name) @tasks ||= [] existing_task = @tasks.find { |task| task.name == name } if existing_task existing_task else new_task = new(name) @tasks << new_task new_task end end |
Instance Method Details
#to_s ⇒ Object
27 28 29 |
# File 'lib/rake_flow_visualizer/task.rb', line 27 def to_s @name end |