Class: Object

Inherits:
BasicObject
Defined in:
lib/shenanigans/object/display.rb

Instance Method Summary collapse

Instance Method Details

#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.

Examples:

"foo".display
foo #=> "foo"

"foo".display(false)
foo#=> "foo"


12
13
14
15
# File 'lib/shenanigans/object/display.rb', line 12

def display(new_line = true)
  m = new_line ? :puts : :print
  tap { |o| send(m, o) }
end