Class: Fit4Ruby::Record

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRecord

Returns a new instance of Record.



20
21
# File 'lib/fit4ruby/Record.rb', line 20

def initialize
end

Instance Attribute Details

#altitudeObject (readonly)

Returns the value of attribute altitude.



17
18
19
# File 'lib/fit4ruby/Record.rb', line 17

def altitude
  @altitude
end

#cadenceObject (readonly)

Returns the value of attribute cadence.



17
18
19
# File 'lib/fit4ruby/Record.rb', line 17

def cadence
  @cadence
end

#distanceObject (readonly)

Returns the value of attribute distance.



17
18
19
# File 'lib/fit4ruby/Record.rb', line 17

def distance
  @distance
end

#latitudeObject (readonly)

Returns the value of attribute latitude.



17
18
19
# File 'lib/fit4ruby/Record.rb', line 17

def latitude
  @latitude
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



17
18
19
# File 'lib/fit4ruby/Record.rb', line 17

def longitude
  @longitude
end

#speedObject (readonly)

Returns the value of attribute speed.



17
18
19
# File 'lib/fit4ruby/Record.rb', line 17

def speed
  @speed
end

#stance_timeObject (readonly)

Returns the value of attribute stance_time.



17
18
19
# File 'lib/fit4ruby/Record.rb', line 17

def stance_time
  @stance_time
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



17
18
19
# File 'lib/fit4ruby/Record.rb', line 17

def timestamp
  @timestamp
end

#vertical_oscillationObject (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

#paceObject



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'
    @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