Class: CSstats::Writer::FileWriter::Handler
- Inherits:
-
Object
- Object
- CSstats::Writer::FileWriter::Handler
- Defined in:
- lib/csstats/writer/file_writer/handler.rb
Instance Attribute Summary collapse
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
Instance Method Summary collapse
-
#initialize(handle) ⇒ Handler
constructor
A new instance of Handler.
- #write_int_data(int) ⇒ Object
- #write_short_data(int) ⇒ Object
- #write_string_data(string) ⇒ Object
Constructor Details
#initialize(handle) ⇒ Handler
Returns a new instance of Handler.
7 8 9 |
# File 'lib/csstats/writer/file_writer/handler.rb', line 7 def initialize(handle) @handle = handle end |
Instance Attribute Details
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
5 6 7 |
# File 'lib/csstats/writer/file_writer/handler.rb', line 5 def handle @handle end |
Instance Method Details
#write_int_data(int) ⇒ Object
11 12 13 14 |
# File 'lib/csstats/writer/file_writer/handler.rb', line 11 def write_int_data(int) data = [int].pack('V') handle.write(data) end |
#write_short_data(int) ⇒ Object
16 17 18 19 |
# File 'lib/csstats/writer/file_writer/handler.rb', line 16 def write_short_data(int) data = [int].pack('v') handle.write(data) end |
#write_string_data(string) ⇒ Object
21 22 23 24 |
# File 'lib/csstats/writer/file_writer/handler.rb', line 21 def write_string_data(string) data = "#{string}\x00" handle.write(data) end |