Class: GoodData::Bam::DSL::FlowDSL
- Inherits:
-
Object
- Object
- GoodData::Bam::DSL::FlowDSL
- Defined in:
- lib/dsl/dsl.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
Instance Method Summary collapse
- #graph(data, &bl) ⇒ Object
-
#initialize(data = {}, &bl) ⇒ FlowDSL
constructor
A new instance of FlowDSL.
- #sink(data = {}) ⇒ Object
- #tap(data = {}) ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(data = {}, &bl) ⇒ FlowDSL
Returns a new instance of FlowDSL.
13 14 15 16 17 18 19 20 |
# File 'lib/dsl/dsl.rb', line 13 def initialize(data={}, &bl) fail "Flows params needs a hash" unless data.is_a? Hash name = data[:id] fail "Flow needs to have a name" if name.blank? @name = name @steps = [] instance_eval(&bl) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/dsl/dsl.rb', line 11 def name @name end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps.
11 12 13 |
# File 'lib/dsl/dsl.rb', line 11 def steps @steps end |
Instance Method Details
#graph(data, &bl) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/dsl/dsl.rb', line 32 def graph(data, &bl) fail "Params for graph need to be hash" unless data.is_a? Hash # @steps << {:type => :graph , :flow_id => @name}.merge(data) if bl.nil? @steps << {:type => :graph, :steps => [], :flow_id => @name}.merge(data) else = GraphDSL.new(@name, &bl) @steps << {:type => :graph, :steps => .to_a, :flow_id => @name}.merge(data) end end |
#sink(data = {}) ⇒ Object
27 28 29 30 |
# File 'lib/dsl/dsl.rb', line 27 def sink(data={}) fail "Params for tap need to be hash" unless data.is_a? Hash @steps << {:type => :sink , :flow_id => @name}.merge(data) end |
#tap(data = {}) ⇒ Object
22 23 24 25 |
# File 'lib/dsl/dsl.rb', line 22 def tap(data={}) fail "Params for tap need to be hash" unless data.is_a? Hash @steps << {:type => :tap, :flow_id => @name}.merge(data) end |
#to_hash ⇒ Object
43 44 45 46 47 48 |
# File 'lib/dsl/dsl.rb', line 43 def to_hash { :name => @name, :steps => @steps } end |