Module: Tillless::Location::RubyInstanceMethods

Defined in:
lib/tillless-core/location.rb

Instance Method Summary collapse

Instance Method Details

#initialize(hash = {}) ⇒ Object

Assumes that :lat and :lon are Doubles / Floats



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/tillless-core/location.rb', line 97

def initialize(hash = {})

  # lat and lon coordinates of loation
  @lat = hash[:lat]
  @lon = hash[:lon]

  # components of the Great Circle formula
  @term1  = 0.0;
  @term2  = 0.0;
  @term3  = 0.0;
  @term4  = 0.0;
  @term5  = 0.0;
  @term6  = 0.0;

  # calibrate on creation to do first half of Great Circle calculation
  calibrate
end

#lat=(_lat) ⇒ Object

These methods are only valid for a ruby class and will break an ActiveRecord model Set lat value for the location and mark the location as !calibrated



117
118
119
120
# File 'lib/tillless-core/location.rb', line 117

def lat=(_lat)
  @lat = _lat
  @calibrated = false
end

#lon=(_lon) ⇒ Object

Set lon value for the location and mark the location as !calibrated



123
124
125
126
# File 'lib/tillless-core/location.rb', line 123

def lon=(_lon)
  @lon = lon
  @calibrated = false
end