Class: Campa::Core::Print
- Inherits:
-
Object
- Object
- Campa::Core::Print
- Defined in:
- lib/campa/core/print.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.
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.
16 17 18 19 20 21 22 23 |
# File 'lib/campa/core/print.rb', line 16 def call(*stuff, env:) string = stuff .map { |s| s.is_a?(String) ? s : printer.call(s) } .join(" ") (env[SYMBOL_OUT] || $stdout).print(string) nil end |