Method: Main::Program::InstanceMethods#stdout=
- Defined in:
- lib/main/program/instance_methods.rb
#stdout=(io) ⇒ Object
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/main/program/instance_methods.rb', line 134 def stdout= io unless(defined?(@stdout) and (@stdout == io)) @stdout = if io.respond_to?('write') io else fd = open(io.to_s, 'w+') finalizers.push(lambda{ fd.close }) fd end begin STDOUT.reopen(@stdout) rescue $stdout = @stdout ::Object.send(:remove_const, 'STDOUT') ::Object.send(:const_set, 'STDOUT', @stdout) end end end |