Class: Tablescript::NamespaceGenerator

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

Overview

NamespaceGenerator

Instance Method Summary collapse

Constructor Details

#initialize(scope) ⇒ NamespaceGenerator

Returns a new instance of NamespaceGenerator.



6
7
8
# File 'lib/tablescript/namespace_generator.rb', line 6

def initialize(scope)
  @scope = scope
end

Instance Method Details

#namespace(name, &blk) ⇒ Object



10
11
12
13
# File 'lib/tablescript/namespace_generator.rb', line 10

def namespace(name, &blk)
  generator = NamespaceGenerator.new(@scope.namespace(name.to_s))
  generator.instance_eval(&blk)
end

#table(name, &blk) ⇒ Object



15
16
17
18
# File 'lib/tablescript/namespace_generator.rb', line 15

def table(name, &blk)
  table = Table.new(name.to_s, @scope, &blk)
  @scope.add(table)
end