Class: Kojak::Printer::Basic
- Inherits:
-
Kojak::Printer
- Object
- Kojak::Printer
- Kojak::Printer::Basic
- Defined in:
- lib/kojak/printer/basic.rb
Overview
Internal: Basic printer. It prints stuff to configured output stream.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(out) ⇒ Basic
constructor
Public: Constructor.
- #write(s, *args) ⇒ Object
Methods inherited from Kojak::Printer
Constructor Details
#initialize(out) ⇒ Basic
Public: Constructor. Configures printer to write to given output stream.
out - The Stream to write data to.
Returns nothing.
11 12 13 |
# File 'lib/kojak/printer/basic.rb', line 11 def initialize(out) @out = out end |
Instance Method Details
#write(s, *args) ⇒ Object
15 16 17 18 |
# File 'lib/kojak/printer/basic.rb', line 15 def write(s, *args) args = args.map { |x| JSON.pretty_generate(x) rescue x.inspect } @out.write(s.to_s % args) end |