Skip to content

Instantly share code, notes, and snippets.

@nefo-mi
Created September 7, 2010 09:17
Show Gist options
  • Save nefo-mi/568070 to your computer and use it in GitHub Desktop.
Save nefo-mi/568070 to your computer and use it in GitHub Desktop.
class Display
attr_accessor :print
def initialize
@print = []
end
def write(msg)
@print.push(msg)
end
end
disp = Display.new
$stdout = disp
puts "hogehuga"
$stdout = STDOUT
puts disp.print.to_s.chomp + "hago"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment