class Spektrum::Log::SpeedRecord
Public Class Methods
new(timestamp, raw_data)
click to toggle source
Calls superclass method
Spektrum::Log::Record::new
# File lib/spektrum/log/records.rb, line 327 def initialize(timestamp, raw_data) super timestamp, raw_data end
Public Instance Methods
speed(unit = :knots)
click to toggle source
Gets the speed, in desired unit.
@param unit one of :knots, :mph, :kph to define desired unit @return [Float] speed in the desired unit
# File lib/spektrum/log/records.rb, line 335 def speed(unit = :knots) @speed ||= two_byte_field(2..3) case unit when :knots @speed * 0.539957 when :mph @speed * 0.621371 when :kph @speed else @speed end end