Class: Rlocu::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/utilities.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lat, long) ⇒ Location



13
14
15
16
17
18
19
# File 'lib/utilities.rb', line 13

def initialize(lat, long)
  if !lat.is_a?(Numeric) || !long.is_a?(Numeric)
    raise ArgumentError.new "Lat and long must be numeric (floats)" 
  end
  @lat = lat
  @long = long
end

Instance Attribute Details

#latObject

Returns the value of attribute lat.



11
12
13
# File 'lib/utilities.rb', line 11

def lat
  @lat
end

#longObject

Returns the value of attribute long.



11
12
13
# File 'lib/utilities.rb', line 11

def long
  @long
end

Instance Method Details

#to_sObject



21
22
23
# File 'lib/utilities.rb', line 21

def to_s
  "#{lat},#{long}"
end