Object
# File lib/awesome_print/inspector.rb, line 24 def initialize(options = {}) @options = { :indent => 4, # Indent using 4 spaces. :index => true, # Display array indices. :html => false, # Use ANSI color codes rather than HTML. :multiline => true, # Display in multiple lines. :plain => false, # Use colors. :sort_keys => false, # Do not sort hash keys. :limit => false, # Limit large output for arrays and hashes. Set to a boolean or integer. :color => { :args => :pale, :array => :white, :bigdecimal => :blue, :class => :yellow, :date => :greenish, :falseclass => :red, :fixnum => :blue, :float => :blue, :hash => :pale, :keyword => :cyan, :method => :purpleish, :nilclass => :red, :string => :yellowish, :struct => :pale, :symbol => :cyanish, :time => :greenish, :trueclass => :green, :variable => :cyanish } } # Merge custom defaults and let explicit options parameter override them. merge_custom_defaults! merge_options!(options) @formatter = AwesomePrint::Formatter.new(self) Thread.current[AP] ||= [] end
Dispatcher that detects data nesting and invokes object-aware formatter.
# File lib/awesome_print/inspector.rb, line 65 def awesome(object) if Thread.current[AP].include?(object.object_id) nested(object) else begin Thread.current[AP] << object.object_id unnested(object) ensure Thread.current[AP].pop end end end
Generated with the Darkfish Rdoc Generator 2.