Class: Rity::Body

Inherits:
StringIO
  • Object
show all
Includes:
EM::Deferrable
Defined in:
lib/rity/body.rb

Instance Method Summary collapse

Instance Method Details

#close_writeObject



9
10
11
12
# File 'lib/rity/body.rb', line 9

def close_write
  super
  succeed
end

#receive(&block) ⇒ Object



19
20
21
22
23
# File 'lib/rity/body.rb', line 19

def receive(&block)
  string.each_line &block
  @receiver = block
  sync
end

#syncObject



25
26
27
# File 'lib/rity/body.rb', line 25

def sync
  EM::Synchrony.sync self
end

#write(str) ⇒ Object



14
15
16
17
# File 'lib/rity/body.rb', line 14

def write(str)
  super
  @receiver.call str if @receiver
end