Class: Osmer::Schema::Custom::Table

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

Defined Under Namespace

Classes: Dsl

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Configurable

#configure

Constructor Details

#initialize(schema, name, type, options) ⇒ Table

Returns a new instance of Table.



149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/osmer/schema/custom.rb', line 149

def initialize(schema, name, type, options)
  require 'osmer/mapper/type'
  require 'osmer/mapper/name'

  @schema, @name, @type = schema, name, type

  @source_table = type.to_s.gsub(/\Amulti/,'')
  @source_schema = schema.ns.find_schema(options[:source] || schema.source || :source) or raise StandardError.new("Source schema not found")

  @mappers = {
    :type => Osmer::Mapper::Type.new(self, :type),
    :name => Osmer::Mapper::Name.new(self, :name)
  }
end

Instance Attribute Details

#mappersObject (readonly)

Returns the value of attribute mappers.



147
148
149
# File 'lib/osmer/schema/custom.rb', line 147

def mappers
  @mappers
end

#nameObject (readonly)

Returns the value of attribute name.



147
148
149
# File 'lib/osmer/schema/custom.rb', line 147

def name
  @name
end

#schemaObject (readonly)

Returns the value of attribute schema.



147
148
149
# File 'lib/osmer/schema/custom.rb', line 147

def schema
  @schema
end

#source_schemaObject (readonly)

Returns the value of attribute source_schema.



147
148
149
# File 'lib/osmer/schema/custom.rb', line 147

def source_schema
  @source_schema
end

#source_tableObject (readonly)

Returns the value of attribute source_table.



147
148
149
# File 'lib/osmer/schema/custom.rb', line 147

def source_table
  @source_table
end

#typeObject (readonly)

Returns the value of attribute type.



147
148
149
# File 'lib/osmer/schema/custom.rb', line 147

def type
  @type
end

Instance Method Details

#projectionObject



164
165
166
# File 'lib/osmer/schema/custom.rb', line 164

def projection
  schema.projection
end