Class: AwesomePrint

Inherits:
Object show all
Defined in:
lib/ap/awesome_print.rb

Constant Summary collapse

AP =
:__awesome_print__
CORE =
[ :array, :hash, :class, :file, :dir, :bigdecimal, :rational, :struct, :method, :unboundmethod ]

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ AwesomePrint

Returns a new instance of AwesomePrint



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/ap/awesome_print.rb', line 12

def initialize(options = {})
  @options = { 
    :multiline => true,
    :plain     => false,
    :indent    => 4,
    :index     => true,
    :sorted_hash_keys => false,
    :color     => { 
      :array      => :white,
      :bigdecimal => :blue,
      :class      => :yellow,
      :date       => :greenish,
      :falseclass => :red,
      :fixnum     => :blue,
      :float      => :blue,
      :hash       => :pale,
      :struct     => :pale,
      :nilclass   => :red,
      :string     => :yellowish,
      :symbol     => :cyanish,
      :time       => :greenish,
      :trueclass  => :green,
      :method     => :purpleish,
      :args       => :pale
    }
  }

  # Merge custom defaults and let explicit options parameter override them.
  merge_custom_defaults!
  merge_options!(options)

  @indentation = @options[:indent].abs
  Thread.current[AP] ||= []
end