Class: EventMachine::Zipper::StreamIO

Inherits:
Object
  • Object
show all
Includes:
Deferrable
Defined in:
lib/em-zipper/stream_io.rb

Instance Method Summary collapse

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

#posObject



17
18
19
# File 'lib/em-zipper/stream_io.rb', line 17

def pos
  @pos
end

#tellObject



13
14
15
# File 'lib/em-zipper/stream_io.rb', line 13

def tell
  @pos
end