Class: ActiveRecordMysqlSpatial::ActiveRecord::MySQL::Geometrycollection

Inherits:
Base
  • Object
show all
Defined in:
lib/active_record_mysql_spatial/active_record/mysql/geometrycollection.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#error, #error_backtrace, #raw

Instance Method Summary collapse

Methods inherited from Base

#deserialize, #serialize

Instance Attribute Details

#itemsObject

Returns the value of attribute items.



17
18
19
# File 'lib/active_record_mysql_spatial/active_record/mysql/geometrycollection.rb', line 17

def items
  @items
end

Instance Method Details

#==(other) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/active_record_mysql_spatial/active_record/mysql/geometrycollection.rb', line 33

def ==(other)
  return false if super == false

  items.each_with_index do |item, index|
    return false if item != other.items[index]
  end

  true
end

#to_coordinates_sqlObject



29
30
31
# File 'lib/active_record_mysql_spatial/active_record/mysql/geometrycollection.rb', line 29

def to_coordinates_sql
  items.map(&:to_sql).compact.join(', ')
end

#to_sqlObject



23
24
25
26
27
# File 'lib/active_record_mysql_spatial/active_record/mysql/geometrycollection.rb', line 23

def to_sql
  return nil if @items.blank?

  "GeometryCollection(#{to_coordinates_sql})"
end

#typeObject



19
20
21
# File 'lib/active_record_mysql_spatial/active_record/mysql/geometrycollection.rb', line 19

def type
  :geometrycollection
end