Maybe use this technique on http://thinkingdigitally.com/archive/capturing-output-from-puts-in-ruby/

```ruby
require 'stringio'
 
module Kernel
 
  def capture_stdout
    out = StringIO.new
    $stdout = out
    yield
    return out
  ensure
    $stdout = STDOUT
  end
 
end

results = capture_stdout do
  puts "hi!"
end

results.string
=> "hi!\n"
```

Only real tricky part is the "\n".... if you hate that, you could change to 

```ruby
results = capture_stdout do
  print "hi"
end
results.string
=> "hi"
```