Module: Hashie::Extensions::PrettyInspect

Included in:
Dash, Hash, Mash
Defined in:
lib/hashie/extensions/pretty_inspect.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object


4
5
6
7
# File 'lib/hashie/extensions/pretty_inspect.rb', line 4

def self.included(base)
  base.send :alias_method, :hash_inspect, :inspect
  base.send :alias_method, :inspect, :hashie_inspect
end

Instance Method Details

#hashie_inspectObject


9
10
11
12
13
14
15
16
# File 'lib/hashie/extensions/pretty_inspect.rb', line 9

def hashie_inspect
  ret = "#<#{self.class}"
  keys.sort_by(&:to_s).each do |key|
    ret << " #{key}=#{self[key].inspect}"
  end
  ret << '>'
  ret
end