class Hash - i18n-0.6.11 Documentation

# class Hash

### Constants

MERGER

  deep_merge_hash! by Stefan Rusterholz, see www.ruby-forum.com/topic/142809

### Public Instance Methods

deep_merge!(data) click to toggle source

    # File lib/i18n/core_ext/hash.rb, line 25
    def deep_merge!(data)
      merge!(data, &MERGER)
    end

deep_symbolize_keys() click to toggle source

    # File lib/i18n/core_ext/hash.rb, line 12
    def deep_symbolize_keys
      inject({}) { |result, (key, value)|
        value = value.deep_symbolize_keys if value.is_a?(Hash)
        result[(key.to_sym rescue key) || key] = value
        result
      }
    end

except(*less_keys) click to toggle source

    # File lib/i18n/core_ext/hash.rb, line 8
    def except(*less_keys)
      slice(*keys - less_keys)
    end

slice(*keep_keys) click to toggle source

    # File lib/i18n/core_ext/hash.rb, line 2
    def slice(*keep_keys)
      h = {}
      keep_keys.each { |key| h[key] = fetch(key) }
      h
    end