class Temill::Emitters::Printer

Attributes

indent[RW]
output_lines[R]

Public Class Methods

new(io = $stdout, **options) click to toggle source
# File lib/temill/emitter.rb, line 108
def initialize(io = $stdout, **options)
  @options = options
  @output_lines = 0
  @indent = ''
  @io = io
end

Public Instance Methods

lineno() click to toggle source
# File lib/temill/emitter.rb, line 115
def lineno
  @output_lines + 1
end
obj_to_s(obj) click to toggle source
# File lib/temill/emitter.rb, line 119
def obj_to_s(obj)
  case f = @options[:inspect]
  when Symbol
    obj.__send__(f)
  when nil
    obj.pretty_inspect
  else
    f.call(obj)
  end
end
out(str) click to toggle source
# File lib/temill/emitter.rb, line 153
def out(str)
  @io.print(str)
  self
end
out_nl(str=nil) click to toggle source
# File lib/temill/emitter.rb, line 158
def out_nl(str=nil)
  @io.puts(str)
  @output_lines += 1
  self
end
print(obj) click to toggle source
print_empty_line() click to toggle source
print_raw(str) click to toggle source
print_str(str) click to toggle source