aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb
blob: 0420e206af027355106a92663b8e28dd5a7b868d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'active_support/hash_with_indifferent_access'

class Hash

  # Returns an +ActiveSupport::HashWithIndifferentAccess+ out of its receiver:
  #
  #   {:a => 1}.with_indifferent_access["a"] # => 1
  #
  def with_indifferent_access
    hash = ActiveSupport::HashWithIndifferentAccess.new(self)
    hash.default = self.default
    hash
  end
end