Method: Object#display
- Defined in:
- lib/shenanigans/object/display.rb
#display(new_line = true) ⇒ Object Also known as: d
Outputs the object and also returns it. Will use puts
if new_line
is true
and print
otherwise.
"foo".display
foo
#=> "foo"
"foo".display(false)
foo#=> "foo"
11 12 13 14 |
# File 'lib/shenanigans/object/display.rb', line 11 def display(new_line = true) m = new_line ? :puts : :print self.tap { |o| send(m, o) } end |