Class: Dyna::DSL

Inherits:
Object
  • Object
show all
Includes:
TemplateHelper
Defined in:
lib/dyna/dsl.rb,
lib/dyna/dsl/table.rb,
lib/dyna/dsl/converter.rb,
lib/dyna/dsl/dynamo_db.rb

Defined Under Namespace

Classes: Converter, DynamoDB

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from TemplateHelper

#context, #include_template

Constructor Details

#initialize(path, &block) ⇒ DSL

Returns a new instance of DSL.



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/dyna/dsl.rb', line 19

def initialize(path, &block)
  @path = path
  @result = OpenStruct.new(:ddbs => {})

  @context = Hashie::Mash.new(
    :path      => path,
    :templates => {},
  )

  instance_eval(&block)
end

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



17
18
19
# File 'lib/dyna/dsl.rb', line 17

def result
  @result
end

Class Method Details

.convert(region, exported) ⇒ Object



12
13
14
# File 'lib/dyna/dsl.rb', line 12

def convert(region, exported)
  Converter.convert(region, exported)
end

.define(source, path) ⇒ Object



6
7
8
9
10
# File 'lib/dyna/dsl.rb', line 6

def define(source, path)
  self.new(path) do
    eval(source, binding, path)
  end
end