Class: PrintWrapper
Overview
A PrintWrapper prints arguments by calling a printer proc.
Instance Method Summary collapse
-
#initialize(*args) ⇒ PrintWrapper
constructor
Creates a new PrintWrapper on the given arguments.
-
#to_s ⇒ Object
(also: #inspect)
Calls this PrintWrapper’s print procedure on the arguments set in the initializer.
-
#wrap(*args) ⇒ PrintWrapper
Self.
Constructor Details
#initialize(*args) ⇒ PrintWrapper
Creates a new PrintWrapper on the given arguments.
28 29 30 31 |
# File 'lib/jinx/helpers/pretty_print.rb', line 28 def initialize(*args) super() @args = args end |
Instance Method Details
#to_s ⇒ Object Also known as: inspect
Calls this PrintWrapper’s print procedure on the arguments set in the initializer.
41 42 43 |
# File 'lib/jinx/helpers/pretty_print.rb', line 41 def to_s @args.empty? ? 'nil' : call(*@args) end |
#wrap(*args) ⇒ PrintWrapper
Returns self.
35 36 37 38 |
# File 'lib/jinx/helpers/pretty_print.rb', line 35 def wrap(*args) @args = args self end |