Class: Webmachine::Adapters::Ring::RingRequest::Body

Inherits:
Object
  • Object
show all
Defined in:
lib/webmachine/adapters/ring.rb

Instance Method Summary collapse

Constructor Details

#initialize(body) ⇒ Body

Returns a new instance of Body.



129
130
131
# File 'lib/webmachine/adapters/ring.rb', line 129

def initialize(body)
  @body = body
end

Instance Method Details

#eachObject



142
143
144
145
146
147
148
149
# File 'lib/webmachine/adapters/ring.rb', line 142

def each
  if @value
    @value.each {|chunk| yield chunk }
  else
    @value = []
    @body.each {|chunk| @value << chunk; yield chunk }
  end
end

#to_sObject



133
134
135
136
137
138
139
140
# File 'lib/webmachine/adapters/ring.rb', line 133

def to_s
  if @value
    @value.join
  else
    @body.rewind
    @body.read
  end
end