Class: LiveF1::Packet::Sys::Speed
Instance Attribute Summary
Attributes included from Decryptable
#raw_data
#data, #header, #source
Instance Method Summary
collapse
#bytes, #data=
Methods included from Type::Long
#length, #spare_bits
from_source, #initialize, #inspect, #leader, #spare_bits, #spare_data
Constructor Details
This class inherits a constructor from LiveF1::Packet
Instance Method Details
#speeds ⇒ Object
12
13
14
|
# File 'lib/live_f1/packet/sys/speed.rb', line 12
def speeds
data[1..-1].split(/\s+/).each_slice(2).map { |d,s| "%s: %d" % [d,s] }.join(", ")
end
|
#to_s ⇒ Object
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/live_f1/packet/sys/speed.rb', line 16
def to_s
out = case trap
when 1..4
speeds
else
data[1..-1]
end
"[%d] %s" % [trap, out]
end
|
#trap ⇒ Object
8
9
10
|
# File 'lib/live_f1/packet/sys/speed.rb', line 8
def trap
data.bytes.first
end
|