Sha256: 8fb7bfe77ce4e3d51387f0c26d3ea4ae970861b36564cb049b060b7cc3bfc943

Contents?: true

Size: 275 Bytes

Versions: 4

Compression:

Stored size: 275 Bytes

Contents

module Iso639
  class InsensitiveHash < Hash # :nodoc:
    def [](key)
      super normalize(key)
    end

    def []=(key, value)
      super normalize(key), value
    end

    private

    def normalize(key)
      key.to_s.downcase.strip.split("_").first
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
iso639-1.3.1 lib/iso639/insensitive_hash.rb
iso639-1.3.0 lib/iso639/insensitive_hash.rb
iso639-1.2.1 lib/iso639/insensitive_hash.rb
iso639-1.2.0 lib/iso639/insensitive_hash.rb