Wraps another IO object. Everything written to the PseudoIO will not only be immediately forwarded to the underlying IO object but will also be captured in a buffer. The contents of the buffer can be retrieved by calling done!.
# File lib/phusion_passenger/utils.rb, line 509 def initialize(sink) @sink = sink || File.open("/dev/null", "w") @buffer = StringIO.new end
# File lib/phusion_passenger/utils.rb, line 514 def done! result = @buffer.string @buffer = nil return result end
# File lib/phusion_passenger/utils.rb, line 524 def method_missing(*args, &block) @buffer.send(*args, &block) if @buffer && args.first != :reopen return @sink.send(*args, &block) end
# File lib/phusion_passenger/utils.rb, line 529 def respond_to?(symbol, include_private = false) return @sink.respond_to?(symbol, include_private) end
# File lib/phusion_passenger/utils.rb, line 520 def to_io return self end