class Merb::Rack::StreamWrapper

Public Class Methods

new(body) click to toggle source

:api: private

# File lib/merb-core/rack/stream_wrapper.rb, line 6
def initialize(body)
   @body = body
end

Public Instance Methods

==(other) click to toggle source

:api: private

# File lib/merb-core/rack/stream_wrapper.rb, line 38
def ==(other)
  @body == other
end
each(&callback) click to toggle source

:api: private

# File lib/merb-core/rack/stream_wrapper.rb, line 11
def each(&callback)
  if Proc === @body
    @writer = lambda { |x| callback.call(x) }
    @body.call(self)
  elsif @body.is_a?(String)
    @body.each_line(&callback)
  elsif @body.nil?
    @body.to_s.each_line(&callback)
  elsif @body.is_a?(Integer)
    @body.to_s.each_line(&callback)
  else
    @body.each(&callback)
  end
end
method_missing(sym, *args, &blk) click to toggle source

:api: private

# File lib/merb-core/rack/stream_wrapper.rb, line 43
def method_missing(sym, *args, &blk)
  @body.send(sym, *args, &blk)
end
to_s() click to toggle source

:api: private

# File lib/merb-core/rack/stream_wrapper.rb, line 33
def to_s
  @body.to_s
end
write(str) click to toggle source

:api: private

# File lib/merb-core/rack/stream_wrapper.rb, line 27
def write(str)
  @writer.call str.to_s
  str
end