Class: GoodData::Bam::DSL::GraphDSL

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

Instance Method Summary collapse

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_aObject



78
79
80
# File 'lib/dsl/dsl.rb', line 78

def to_a
  @steps
end

#to_hashObject



71
72
73
74
75
76
# File 'lib/dsl/dsl.rb', line 71

def to_hash
  {
    :name => @name,
    :steps => @steps
  }
end