Class: Osmer::Schema::Custom

Inherits:
Base
  • Object
show all
Defined in:
lib/osmer/schema/custom.rb

Defined Under Namespace

Classes: Dsl, Table

Instance Attribute Summary collapse

Attributes inherited from Base

#name, #ns, #projection

Instance Method Summary collapse

Methods inherited from Base

#attach_listener!, #detach_listener!, #recreate!, #table_prefix

Methods included from Configurable

#configure

Constructor Details

#initialize(*args) ⇒ Custom

Returns a new instance of Custom.



8
9
10
11
# File 'lib/osmer/schema/custom.rb', line 8

def initialize(*args)
  @tables = []
  super
end

Instance Attribute Details

#sourceObject

Returns the value of attribute source.



6
7
8
# File 'lib/osmer/schema/custom.rb', line 6

def source
  @source
end

#tablesObject (readonly)

Returns the value of attribute tables.



5
6
7
# File 'lib/osmer/schema/custom.rb', line 5

def tables
  @tables
end

Instance Method Details

#create!(db) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/osmer/schema/custom.rb', line 17

def create!(db)
  db.in_transaction do |conn|
    tables.each do |table|
      create_table! db, conn, table
    end
  end
end

#drop!(db) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/osmer/schema/custom.rb', line 25

def drop!(db)
  db.in_transaction do |conn|
    tables.reverse.each do |table|
      drop_table! db, conn, table
    end
  end
end

#dslObject



13
14
15
# File 'lib/osmer/schema/custom.rb', line 13

def dsl
  Dsl.new(self)
end