class Kojak::Printer::Basic

Internal: Basic printer. It prints stuff to configured output stream.

Public Class Methods

new(out) click to toggle source

Public: Constructor. Configures printer to write to given output stream.

out - The Stream to write data to.

Returns nothing.

# File lib/kojak/printer/basic.rb, line 11
def initialize(out)
  @out = out
end

Public Instance Methods

write(s, *args) click to toggle source
# 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