Class: ActiveRecordMysqlSpatial::ActiveRecord::MySQL::Linestring
- Inherits:
-
Base
- Object
- ActiveRecord::Type::Json
- Base
- ActiveRecordMysqlSpatial::ActiveRecord::MySQL::Linestring
show all
- Defined in:
- lib/active_record_mysql_spatial/active_record/mysql/linestring.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
#items ⇒ Object
Returns the value of attribute items.
10
11
12
|
# File 'lib/active_record_mysql_spatial/active_record/mysql/linestring.rb', line 10
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/linestring.rb', line 33
def ==(other)
return false if super == false
items.each_with_index do |coord, index|
return false if coord != other.items[index]
end
true
end
|
#coordinates ⇒ Object
16
17
18
19
20
21
|
# File 'lib/active_record_mysql_spatial/active_record/mysql/linestring.rb', line 16
def coordinates
puts 'coordinates is deprecated. Please use items instead.'
@items
end
|
#to_coordinates_sql ⇒ Object
29
30
31
|
# File 'lib/active_record_mysql_spatial/active_record/mysql/linestring.rb', line 29
def to_coordinates_sql
@items.map(&:to_coordinate_sql).compact.join(', ')
end
|
#to_sql ⇒ Object
23
24
25
26
27
|
# File 'lib/active_record_mysql_spatial/active_record/mysql/linestring.rb', line 23
def to_sql
return nil if @items.blank?
"LineString(#{to_coordinates_sql})"
end
|
#type ⇒ Object
12
13
14
|
# File 'lib/active_record_mysql_spatial/active_record/mysql/linestring.rb', line 12
def type
:linestring
end
|