Class: Dina::Geospatial

Inherits:
Object
  • Object
show all
Defined in:
lib/dina/casters/geospatial.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#coordinatesObject

Returns the value of attribute coordinates.



4
5
6
# File 'lib/dina/casters/geospatial.rb', line 4

def coordinates
  @coordinates
end

#typeObject

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_hashObject



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