class Hash

Public Instance Methods

indifferent_fetch(key, *extra) click to toggle source

Light extension to hash to add indifferent fetching. Meant to be more lightweight than depending on ActiveSupport for HashWithIndifferentAccess.

# File lib/certmaker/ext_core/hash_indifferent_fetch.rb, line 5
def indifferent_fetch(key, *extra)
  if key.class == Symbol
    self.fetch(key, self.fetch(key.to_s, *extra))
  else
    self.fetch(key, self.fetch(key.to_sym, *extra))
  end
end