Class: Fit4Ruby::Record
- Inherits:
-
Object
- Object
- Fit4Ruby::Record
- Defined in:
- lib/fit4ruby/Record.rb
Instance Attribute Summary collapse
-
#altitude ⇒ Object
readonly
Returns the value of attribute altitude.
-
#cadence ⇒ Object
readonly
Returns the value of attribute cadence.
-
#distance ⇒ Object
readonly
Returns the value of attribute distance.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#speed ⇒ Object
readonly
Returns the value of attribute speed.
-
#stance_time ⇒ Object
readonly
Returns the value of attribute stance_time.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#vertical_oscillation ⇒ Object
readonly
Returns the value of attribute vertical_oscillation.
Instance Method Summary collapse
-
#initialize ⇒ Record
constructor
A new instance of Record.
- #pace ⇒ Object
- #set(field, value) ⇒ Object
Constructor Details
#initialize ⇒ Record
Returns a new instance of Record.
20 21 |
# File 'lib/fit4ruby/Record.rb', line 20 def initialize end |
Instance Attribute Details
#altitude ⇒ Object (readonly)
Returns the value of attribute altitude.
17 18 19 |
# File 'lib/fit4ruby/Record.rb', line 17 def altitude @altitude end |
#cadence ⇒ Object (readonly)
Returns the value of attribute cadence.
17 18 19 |
# File 'lib/fit4ruby/Record.rb', line 17 def cadence @cadence end |
#distance ⇒ Object (readonly)
Returns the value of attribute distance.
17 18 19 |
# File 'lib/fit4ruby/Record.rb', line 17 def distance @distance end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
17 18 19 |
# File 'lib/fit4ruby/Record.rb', line 17 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
17 18 19 |
# File 'lib/fit4ruby/Record.rb', line 17 def longitude @longitude end |
#speed ⇒ Object (readonly)
Returns the value of attribute speed.
17 18 19 |
# File 'lib/fit4ruby/Record.rb', line 17 def speed @speed end |
#stance_time ⇒ Object (readonly)
Returns the value of attribute stance_time.
17 18 19 |
# File 'lib/fit4ruby/Record.rb', line 17 def stance_time @stance_time end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
17 18 19 |
# File 'lib/fit4ruby/Record.rb', line 17 def end |
#vertical_oscillation ⇒ Object (readonly)
Returns the value of attribute vertical_oscillation.
17 18 19 |
# File 'lib/fit4ruby/Record.rb', line 17 def vertical_oscillation @vertical_oscillation end |
Instance Method Details
#pace ⇒ Object
49 50 51 |
# File 'lib/fit4ruby/Record.rb', line 49 def pace 1000.0 / (@speed * 60.0) end |
#set(field, value) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/fit4ruby/Record.rb', line 23 def set(field, value) case field when 'timestamp' = value when 'position_lat' @latitude = value when 'position_long' @longitude = value when 'altitude' @altitude = value when 'distance' @distance = value when 'speed' @speed = value when 'vertical_oscillation' @vertical_oscillation = value when 'cadence' @cadence = 2 * value when 'fractional_cadence' @cadence += 2 * value if @cadence when 'stance_time' @stance_time = value else end end |