Module: GoodData::Bam::Flow

Defined in:
lib/base/flow.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name.



9
10
11
# File 'lib/base/flow.rb', line 9

def name
  @name
end

#stepsObject

Returns the value of attribute steps.



9
10
11
# File 'lib/base/flow.rb', line 9

def steps
  @steps
end

Class Method Details

.add_step(flow, step) ⇒ Object



23
24
25
26
# File 'lib/base/flow.rb', line 23

def self.add_step(flow, step)
  new_steps = flow[:steps].concat([step])
  Flow.create(flow.merge({:steps => new_steps}))
end

.create(flow) ⇒ Object



5
6
7
# File 'lib/base/flow.rb', line 5

def self.create(flow)
  {:steps => []}.merge(flow).merge({:type => :flow})
end

.define(name = "", &script) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/base/flow.rb', line 11

def self.define(name="", &script)
  # puts "Reading flow #{name}"
  x = self.new
  x.flow_name(name)
  x.instance_eval(&script)
  x
end

.find_graphs(flow) ⇒ Object



19
20
21
# File 'lib/base/flow.rb', line 19

def self.find_graphs(flow)
  flow[:steps].find_all {|s| s[:type] == :graph}
end

.remove_last_step(flow) ⇒ Object



28
29
30
31
# File 'lib/base/flow.rb', line 28

def self.remove_last_step(flow)
  new_steps = flow[:steps][0..-2]
  Flow.create(flow.merge({:steps => new_steps}))
end