Class: Doom::Game::Snapshot::Reader
- Inherits:
-
Object
- Object
- Doom::Game::Snapshot::Reader
- Defined in:
- lib/doom/game/snapshot.rb
Instance Method Summary collapse
- #bool ⇒ Object
- #f64 ⇒ Object
- #i64 ⇒ Object
-
#initialize(bytes) ⇒ Reader
constructor
A new instance of Reader.
- #list ⇒ Object
- #str ⇒ Object
- #u16 ⇒ Object
- #u32 ⇒ Object
- #u8 ⇒ Object
Constructor Details
#initialize(bytes) ⇒ Reader
Returns a new instance of Reader.
63 64 65 66 |
# File 'lib/doom/game/snapshot.rb', line 63 def initialize(bytes) @buf = bytes.b @pos = 0 end |
Instance Method Details
#bool ⇒ Object
73 |
# File 'lib/doom/game/snapshot.rb', line 73 def bool = u8 == 1 |
#f64 ⇒ Object
72 |
# File 'lib/doom/game/snapshot.rb', line 72 def f64 = take(8).unpack1('E') |
#i64 ⇒ Object
71 |
# File 'lib/doom/game/snapshot.rb', line 71 def i64 = take(8).unpack1('q<') |
#list ⇒ Object
79 80 81 |
# File 'lib/doom/game/snapshot.rb', line 79 def list(&) Array.new(u32, &) end |
#str ⇒ Object
75 76 77 |
# File 'lib/doom/game/snapshot.rb', line 75 def str take(u16) end |
#u16 ⇒ Object
69 |
# File 'lib/doom/game/snapshot.rb', line 69 def u16 = take(2).unpack1('S<') |
#u32 ⇒ Object
70 |
# File 'lib/doom/game/snapshot.rb', line 70 def u32 = take(4).unpack1('L<') |
#u8 ⇒ Object
68 |
# File 'lib/doom/game/snapshot.rb', line 68 def u8 = take(1).unpack1('C') |