summaryrefslogtreecommitdiff
path: root/lib/hashie/extensions/array/pretty_inspect.rb
blob: 48ce119b0763fe7dab377c5d3460aec918b9bbc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module Hashie
  module Extensions
    module Array
      module PrettyInspect
        def self.included(base)
          base.send :alias_method, :array_inspect, :inspect
          base.send :alias_method, :inspect, :hashie_inspect
        end

        def hashie_inspect
          ret = "#<#{self.class} ["
          ret << to_a.map(&:inspect).join(', ')
          ret << ']>'
          ret
        end
      end
    end
  end
end