Class: Prissy::Printer

Inherits:
Object
  • Object
show all
Defined in:
lib/prissy/printer.rb

Direct Known Subclasses

ColorPrinter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Printer

Returns a new instance of Printer.



5
6
7
8
9
10
# File 'lib/prissy/printer.rb', line 5

def initialize(options = {})
  @txt = ""
  @indent = 0
  @options = options
  options[:max_width] ||= 80
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/prissy/printer.rb', line 3

def options
  @options
end

Instance Method Details



12
13
14
15
# File 'lib/prissy/printer.rb', line 12

def print(object)
  print_object(object)
  @txt << "\n"
end