Class: LiveF1::Source::Log
- Inherits:
-
LiveF1::Source
- Object
- LiveF1::Source
- LiveF1::Source::Log
- Defined in:
- lib/live_f1/source/log.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Attributes inherited from LiveF1::Source
Instance Method Summary collapse
- #decryption_key(session_number) ⇒ Object
-
#initialize(file) ⇒ Log
constructor
A new instance of Log.
- #keyframe(number = nil) ⇒ Object
- #read_bytes(num) ⇒ Object
Methods inherited from LiveF1::Source
Constructor Details
#initialize(file) ⇒ Log
Returns a new instance of Log.
9 10 11 12 13 |
# File 'lib/live_f1/source/log.rb', line 9 def initialize file @file = file @data = YAML.load(@file.read) @bytes = StringIO.new(@data[:bytes]) end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
7 8 9 |
# File 'lib/live_f1/source/log.rb', line 7 def data @data end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
7 8 9 |
# File 'lib/live_f1/source/log.rb', line 7 def file @file end |
Instance Method Details
#decryption_key(session_number) ⇒ Object
24 25 26 |
# File 'lib/live_f1/source/log.rb', line 24 def decryption_key session_number data[:key].to_i end |
#keyframe(number = nil) ⇒ Object
19 20 21 22 |
# File 'lib/live_f1/source/log.rb', line 19 def keyframe number = nil keyframe_data = data[:keyframes][number.to_s] || "" Source::Keyframe.new StringIO.new(keyframe_data), self end |
#read_bytes(num) ⇒ Object
15 16 17 |
# File 'lib/live_f1/source/log.rb', line 15 def read_bytes num @bytes.read(num) end |