Class: GoodData::Bam::DSL::GraphDSL
- Inherits:
-
Object
- Object
- GoodData::Bam::DSL::GraphDSL
- Defined in:
- lib/dsl/dsl.rb
Instance Method Summary collapse
-
#initialize(flow_name, &bl) ⇒ GraphDSL
constructor
A new instance of GraphDSL.
- #metadata(data, &bl) ⇒ Object
- #to_a ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(flow_name, &bl) ⇒ GraphDSL
Returns a new instance of GraphDSL.
54 55 56 57 58 |
# File 'lib/dsl/dsl.rb', line 54 def initialize(flow_name, &bl) @name = flow_name @steps = [] instance_eval(&bl) end |
Instance Method Details
#metadata(data, &bl) ⇒ Object
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/dsl/dsl.rb', line 60 def (data, &bl) fail "Params need to be hash" unless data.is_a? Hash fail "Metadata definition should have at least \"id\" defined. You provided \"#{data}\"." unless data.has_key?(:id) if bl.nil? @steps << {:type => :graph_metadata, :steps => [], :flow_id => @name}.merge(data) else = MetadataDSL.new(@name, &bl) @steps << {:type => :graph_metadata, :steps => .to_a, :flow_id => @name}.merge(data) end end |
#to_a ⇒ Object
78 79 80 |
# File 'lib/dsl/dsl.rb', line 78 def to_a @steps end |
#to_hash ⇒ Object
71 72 73 74 75 76 |
# File 'lib/dsl/dsl.rb', line 71 def to_hash { :name => @name, :steps => @steps } end |