Class: EventMachine::Zipper::StreamIO
- Inherits:
-
Object
- Object
- EventMachine::Zipper::StreamIO
- Includes:
- Deferrable
- Defined in:
- lib/em-zipper/stream_io.rb
Instance Method Summary collapse
- #<<(x) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(&block) ⇒ StreamIO
constructor
A new instance of StreamIO.
- #pos ⇒ Object
- #tell ⇒ Object
Constructor Details
#initialize(&block) ⇒ StreamIO
Returns a new instance of StreamIO.
8 9 10 11 |
# File 'lib/em-zipper/stream_io.rb', line 8 def initialize(&block) @block = block @pos = 0 end |
Instance Method Details
#<<(x) ⇒ Object
22 23 24 25 |
# File 'lib/em-zipper/stream_io.rb', line 22 def <<(x) @block.call(x.to_s) @pos += x.to_s.bytesize end |
#each(&block) ⇒ Object
27 28 29 |
# File 'lib/em-zipper/stream_io.rb', line 27 def each(&block) @block = block end |
#pos ⇒ Object
17 18 19 |
# File 'lib/em-zipper/stream_io.rb', line 17 def pos @pos end |
#tell ⇒ Object
13 14 15 |
# File 'lib/em-zipper/stream_io.rb', line 13 def tell @pos end |