Class: RakeFlowVisualizer::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/rake_flow_visualizer/task.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#dependenciesObject (readonly)

Returns the value of attribute dependencies.



20
21
22
# File 'lib/rake_flow_visualizer/task.rb', line 20

def dependencies
  @dependencies
end

#nameObject (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

.allObject



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_sObject



27
28
29
# File 'lib/rake_flow_visualizer/task.rb', line 27

def to_s
  @name
end