Class: RubyVolt::ReadPartial
- Inherits:
-
Object
- Object
- RubyVolt::ReadPartial
- Defined in:
- lib/ruby_volt/read_partial.rb
Instance Method Summary collapse
-
#initialize(bytes) ⇒ ReadPartial
constructor
A new instance of ReadPartial.
- #inspect ⇒ Object
- #nread ⇒ Object
- #read(num) ⇒ Object (also: #recv)
Constructor Details
#initialize(bytes) ⇒ ReadPartial
Returns a new instance of ReadPartial.
3 4 5 |
# File 'lib/ruby_volt/read_partial.rb', line 3 def initialize(bytes) @bytes = bytes end |
Instance Method Details
#inspect ⇒ Object
7 8 9 |
# File 'lib/ruby_volt/read_partial.rb', line 7 def inspect "<#{self.class.name}: bytes=#{@bytes.bytesize}>" end |
#nread ⇒ Object
11 12 13 |
# File 'lib/ruby_volt/read_partial.rb', line 11 def nread @bytes.bytesize end |
#read(num) ⇒ Object Also known as: recv
15 16 17 18 19 |
# File 'lib/ruby_volt/read_partial.rb', line 15 def read(num) exp = @bytes.byteslice(0, num) @bytes.delete_prefix!(exp) exp end |