Class: ActiveRecord::ConnectionAdapters::Mysql2Rgeo::ColumnDefinition

Inherits:
MySQL::ColumnDefinition
  • Object
show all
Defined in:
lib/active_record/connection_adapters/mysql2rgeo/spatial_table_definition.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.geo_type(type = "GEOMETRY") ⇒ Object

needs to accept the spatial type? or figure out from limit ?



43
44
45
46
47
48
# File 'lib/active_record/connection_adapters/mysql2rgeo/spatial_table_definition.rb', line 43

def self.geo_type(type = "GEOMETRY")
  g_type = type.to_s.delete("_").upcase
  return "POINT" if g_type == "POINT"
  return "POLYGON" if g_type == "POLYGON"
  g_type
end

Instance Method Details

#spatial_typeObject



50
51
52
# File 'lib/active_record/connection_adapters/mysql2rgeo/spatial_table_definition.rb', line 50

def spatial_type
  @spatial_type
end

#spatial_type=(value) ⇒ Object



54
55
56
# File 'lib/active_record/connection_adapters/mysql2rgeo/spatial_table_definition.rb', line 54

def spatial_type=(value)
  @spatial_type = value.to_s
end

#sridObject



58
59
60
61
62
63
64
# File 'lib/active_record/connection_adapters/mysql2rgeo/spatial_table_definition.rb', line 58

def srid
  if @srid
    @srid.to_i
  else
    Mysql2RgeoAdapter::DEFAULT_SRID
  end
end

#srid=(value) ⇒ Object



66
67
68
# File 'lib/active_record/connection_adapters/mysql2rgeo/spatial_table_definition.rb', line 66

def srid=(value)
  @srid = value
end