Class: Osmer::Schema::Base

Inherits:
Object
  • Object
show all
Includes:
Configurable
Defined in:
lib/osmer/schema/base.rb

Direct Known Subclasses

Custom, Osm2pgsql

Defined Under Namespace

Classes: Dsl

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Configurable

#configure

Constructor Details

#initialize(ns, name, options = {}) ⇒ Base

Returns a new instance of Base.



10
11
12
13
14
15
16
17
18
# File 'lib/osmer/schema/base.rb', line 10

def initialize(ns, name, options = {})
  @ns = ns
  @name = name
  @projection = 4326

  options.each do |k,v| # Assign all schema options
    send "#{k}=", v
  end
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/osmer/schema/base.rb', line 7

def name
  @name
end

#nsObject (readonly)

Returns the value of attribute ns.



7
8
9
# File 'lib/osmer/schema/base.rb', line 7

def ns
  @ns
end

#projectionObject

Returns the value of attribute projection.



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

def projection
  @projection
end

Instance Method Details

#attach_listener!(conn, collection, name, fields) ⇒ Object

Add collection listener name - stored procedure name

Raises:

  • (StandardError)


38
39
40
# File 'lib/osmer/schema/base.rb', line 38

def attach_listener!(conn, collection, name, fields)
  raise StandardError.new("Not implemented")
end

#create!(db) ⇒ Object

Create schema in given database

Raises:

  • (StandardError)


21
22
23
# File 'lib/osmer/schema/base.rb', line 21

def create!(db)
  raise StandardError.new("Not implemented")
end

#detach_listener!(conn, collection, name, fields) ⇒ Object

Raises:

  • (StandardError)


42
43
44
# File 'lib/osmer/schema/base.rb', line 42

def detach_listener!(conn, collection, name, fields)
  raise StandardError.new("Not implemented")
end

#drop!(db) ⇒ Object

Drop schema in given database

Raises:

  • (StandardError)


26
27
28
# File 'lib/osmer/schema/base.rb', line 26

def drop!(db)
  raise StandardError.new("Not implemented")
end

#recreate!(db) ⇒ Object



30
31
32
33
# File 'lib/osmer/schema/base.rb', line 30

def recreate!(db)
  drop! db
  create! db
end

#table_prefixObject



46
47
48
# File 'lib/osmer/schema/base.rb', line 46

def table_prefix
  [@ns.prefix, name].compact.join('_')
end