Class: Lap
Constant Summary collapse
- TYPES =
{ :start => 0, :lap => 1, :stop => 2 }
Instance Attribute Summary collapse
-
#distance ⇒ Object
Returns the value of attribute distance.
-
#position ⇒ Object
Returns the value of attribute position.
-
#straight_line_distance ⇒ Object
Returns the value of attribute straight_line_distance.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(data = nil) ⇒ Lap
constructor
A new instance of Lap.
- #is_of_type?(*types) ⇒ Boolean
- #read_data(data) ⇒ Object
Methods included from DateTimeParser
Constructor Details
#initialize(data = nil) ⇒ Lap
Returns a new instance of Lap.
13 14 15 |
# File 'lib/lap.rb', line 13 def initialize(data = nil) read_data(data) if data end |
Instance Attribute Details
#distance ⇒ Object
Returns the value of attribute distance.
9 10 11 |
# File 'lib/lap.rb', line 9 def distance @distance end |
#position ⇒ Object
Returns the value of attribute position.
9 10 11 |
# File 'lib/lap.rb', line 9 def position @position end |
#straight_line_distance ⇒ Object
Returns the value of attribute straight_line_distance.
9 10 11 |
# File 'lib/lap.rb', line 9 def straight_line_distance @straight_line_distance end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
8 9 10 |
# File 'lib/lap.rb', line 8 def time @time end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/lap.rb', line 8 def type @type end |
Instance Method Details
#is_of_type?(*types) ⇒ Boolean
22 23 24 |
# File 'lib/lap.rb', line 22 def is_of_type?(*types) types.any?{|t| type == TYPES[t]} end |
#read_data(data) ⇒ Object
17 18 19 20 |
# File 'lib/lap.rb', line 17 def read_data(data) @time = read_date_time(data) @type = BinData::Uint8be.read(data) end |