Class: PhusionPassenger::Utils::PseudoIO

Inherits:
Object
  • Object
show all
Defined in:
lib/phusion_passenger/utils.rb

Instance Method Summary collapse

Constructor Details

#initialize(sink) ⇒ PseudoIO

Returns a new instance of PseudoIO.



206
207
208
209
# File 'lib/phusion_passenger/utils.rb', line 206

def initialize(sink)
	@sink = sink || File.open("/dev/null", "w")
	@buffer = StringIO.new
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object



217
218
219
220
# File 'lib/phusion_passenger/utils.rb', line 217

def method_missing(*args, &block)
	@buffer.send(*args, &block) if @buffer && args.first != :reopen
	return @sink.send(*args, &block)
end

Instance Method Details

#done!Object



211
212
213
214
215
# File 'lib/phusion_passenger/utils.rb', line 211

def done!
	result = @buffer.string
	@buffer = nil
	return result
end

#respond_to?(symbol, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


222
223
224
# File 'lib/phusion_passenger/utils.rb', line 222

def respond_to?(symbol, include_private = false)
	return @sink.respond_to?(symbol, include_private)
end