Class: Prissy

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

Defined Under Namespace

Classes: ColorPrinter, Printer

Constant Summary collapse

VERSION =
"1.0.1"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Prissy

Returns a new instance of Prissy.



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

def initialize(options = {})
  defaults = {}

  @options = defaults.merge(options)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



9
10
11
# File 'lib/prissy.rb', line 9

def options
  @options
end

Instance Method Details

#prissy(json_or_hash) ⇒ Object



17
18
19
20
21
# File 'lib/prissy.rb', line 17

def prissy(json_or_hash)
  hash = (json_or_hash.is_a?(String) ? parse(json_or_hash) : json_or_hash)

  printer.print(hash)
end