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!.
Methods
Public Class methods
[ show source ]
# File lib/phusion_passenger/utils.rb, line 519 519: def initialize(sink) 520: @sink = sink || File.open("/dev/null", "w") 521: @buffer = StringIO.new 522: end
Public Instance methods
[ show source ]
# File lib/phusion_passenger/utils.rb, line 524 524: def done! 525: result = @buffer.string 526: @buffer = nil 527: return result 528: end
[ show source ]
# File lib/phusion_passenger/utils.rb, line 534 534: def method_missing(*args, &block) 535: @buffer.send(*args, &block) if @buffer && args.first != :reopen 536: return @sink.send(*args, &block) 537: end
[ show source ]
# File lib/phusion_passenger/utils.rb, line 539 539: def respond_to?(symbol, include_private = false) 540: return @sink.respond_to?(symbol, include_private) 541: end
[ show source ]
# File lib/phusion_passenger/utils.rb, line 530 530: def to_io 531: return self 532: end