Reputation: 22751
How does irb decide how to represent an object that is returned from a statement?
> "foo" => "foo" > 2 => 2
I thought it was the equivalent of print object.inspect
or some such thing, but nothing I try returns the same output.
Upvotes: 2
Views: 76
Reputation: 17030
Well, irb
implements a REPL. It pretty much does this behind scenes:
loop do
'> '.display
input = gets.chomp
value = eval input
puts " => #{value.inspect}"
end
Upvotes: 4