Class: Broutes::GeoPoint
- Inherits:
-
Object
- Object
- Broutes::GeoPoint
- Defined in:
- lib/broutes/geo_point.rb
Instance Attribute Summary collapse
-
#cadence ⇒ Object
Returns the value of attribute cadence.
-
#distance ⇒ Object
Returns the value of attribute distance.
-
#elevation ⇒ Object
Returns the value of attribute elevation.
-
#heart_rate ⇒ Object
Returns the value of attribute heart_rate.
-
#lat ⇒ Object
Returns the value of attribute lat.
-
#lon ⇒ Object
Returns the value of attribute lon.
-
#power ⇒ Object
Returns the value of attribute power.
-
#speed ⇒ Object
Returns the value of attribute speed.
-
#temperature ⇒ Object
Returns the value of attribute temperature.
-
#time ⇒ Object
Returns the value of attribute time.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #has_location? ⇒ Boolean
-
#initialize(args = {}) ⇒ GeoPoint
constructor
A new instance of GeoPoint.
- #to_hash ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ GeoPoint
Returns a new instance of GeoPoint.
8 9 10 |
# File 'lib/broutes/geo_point.rb', line 8 def initialize(args={}) args.each_pair do |key, value| send("#{key}=", value) if respond_to?("#{key}=") end end |
Instance Attribute Details
#cadence ⇒ Object
Returns the value of attribute cadence.
5 6 7 |
# File 'lib/broutes/geo_point.rb', line 5 def cadence @cadence end |
#distance ⇒ Object
Returns the value of attribute distance.
5 6 7 |
# File 'lib/broutes/geo_point.rb', line 5 def distance @distance end |
#elevation ⇒ Object
Returns the value of attribute elevation.
5 6 7 |
# File 'lib/broutes/geo_point.rb', line 5 def elevation @elevation end |
#heart_rate ⇒ Object
Returns the value of attribute heart_rate.
5 6 7 |
# File 'lib/broutes/geo_point.rb', line 5 def heart_rate @heart_rate end |
#lat ⇒ Object
Returns the value of attribute lat.
5 6 7 |
# File 'lib/broutes/geo_point.rb', line 5 def lat @lat end |
#lon ⇒ Object
Returns the value of attribute lon.
5 6 7 |
# File 'lib/broutes/geo_point.rb', line 5 def lon @lon end |
#power ⇒ Object
Returns the value of attribute power.
5 6 7 |
# File 'lib/broutes/geo_point.rb', line 5 def power @power end |
#speed ⇒ Object
Returns the value of attribute speed.
5 6 7 |
# File 'lib/broutes/geo_point.rb', line 5 def speed @speed end |
#temperature ⇒ Object
Returns the value of attribute temperature.
5 6 7 |
# File 'lib/broutes/geo_point.rb', line 5 def temperature @temperature end |
#time ⇒ Object
Returns the value of attribute time.
6 7 8 |
# File 'lib/broutes/geo_point.rb', line 6 def time @time end |
Class Method Details
Instance Method Details
#==(other) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/broutes/geo_point.rb', line 28 def ==(other) lat == other.lat && lon == other.lon && elevation == other.elevation && distance == other.distance && time == other.time && heart_rate == other.heart_rate && power == other.power && speed == other.speed && cadence == other.cadence && temperature == other.temperature end |
#has_location? ⇒ Boolean
16 17 18 |
# File 'lib/broutes/geo_point.rb', line 16 def has_location? lat && lon end |
#to_hash ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/broutes/geo_point.rb', line 41 def to_hash h = {} h['lat'] = lat if lat h['lon'] = lon if lon h['elevation'] = elevation if elevation h['distance'] = distance if distance h['time'] = time if time h['heart_rate'] = heart_rate if heart_rate h['power'] = power if power h['speed'] = speed if speed h['cadence'] = cadence if cadence h['temperature'] = temperature if temperature h end |