Class: Campa::Core::PrintLn
- Inherits:
-
Object
- Object
- Campa::Core::PrintLn
- Defined in:
- lib/campa/core/print_ln.rb
Overview
Campa function that print “anything” to the $stdout.
Instance Method Summary collapse
-
#call(*stuff, env:) ⇒ Object
It uses Printer to transform an Object into a human readable form and sends it to $stdout.
Instance Method Details
#call(*stuff, env:) ⇒ Object
It uses Printer to transform an Object into a human readable form and sends it to $stdout.
Uses #puts method in the output to add a new line after sending each String representation created via Printer be sent to the output.
It is possible to override the preference for using $stdout by binding SYMBOL_OUT to a desired Object in the env given as a parameter to this method.
20 21 22 23 24 |
# File 'lib/campa/core/print_ln.rb', line 20 def call(*stuff, env:) out = env[SYMBOL_OUT] || $stdout stuff.each { |s| out.puts(s.is_a?(String) ? s : printer.call(s)) } nil end |