/usr/lib/ruby/vendor_ruby/merb-core/rack/stream_wrapper.rb is in ruby-merb-core 1.1.3+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | module Merb
module Rack
class StreamWrapper
# :api: private
def initialize(body)
@body = body
end
# :api: private
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
# :api: private
def write(str)
@writer.call str.to_s
str
end
# :api: private
def to_s
@body.to_s
end
# :api: private
def ==(other)
@body == other
end
# :api: private
def method_missing(sym, *args, &blk)
@body.send(sym, *args, &blk)
end
end
end
end
|