Class: Dina::Geospatial
- Inherits:
-
Object
- Object
- Dina::Geospatial
- Defined in:
- lib/dina/casters/geospatial.rb
Instance Attribute Summary collapse
-
#coordinates ⇒ Object
Returns the value of attribute coordinates.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Geospatial
constructor
A new instance of Geospatial.
- #to_hash ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Geospatial
Returns a new instance of Geospatial.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/dina/casters/geospatial.rb', line 6 def initialize(opts = {}) @type = "" @coordinates = [] if opts[:type] @type = opts[:type] end if opts[:coordinates] @coordinates = opts[:coordinates] end end |
Instance Attribute Details
#coordinates ⇒ Object
Returns the value of attribute coordinates.
4 5 6 |
# File 'lib/dina/casters/geospatial.rb', line 4 def coordinates @coordinates end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'lib/dina/casters/geospatial.rb', line 3 def type @type end |
Instance Method Details
#to_hash ⇒ Object
17 18 19 20 21 |
# File 'lib/dina/casters/geospatial.rb', line 17 def to_hash hash = {} instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) } hash end |