Project

cicphash

0.01
No release in over 3 years
Low commit activity in last 3 years
Case Insensitive Case Preserving Hash
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

CICPHash¶ ↑

ruby-cicphash is a library that adds the CICPHash class, which has the same interface as Hash, but is case insensitive and case preserving. Any value can be used as a key. However, you cannot have two keys in the same CICPHash that would be the same if when converted to strings would be equal or differing only in case.

For example, all of the following keys would be considered equalivalent: ‘ab’, ‘Ab’, ‘AB’, ‘aB’, :ab, :Ab, :AB, :aB

CICPHash uses a last match wins policy. If an key-value pair is added to a CICPHash and a case insensitive variant of the key is already in the hash the instance of the key in the hash becomes the same the most recently added key (and the value is updated to reflect the new value).

Example:

require 'cicphash'
hash = CICPHash.new
hash[:AB] = 1
hash['ab'] # => 1
hash['ab']  = 2
hash # => {"ab"=>2}

Installation¶ ↑

gem install cicphash

Source Code¶ ↑

Source code is available on GitHub at github.com/jeremyevans/ruby-cicphash

Reporting Bugs¶ ↑

The bug tracker is located at github.com/jeremyevans/ruby-cicphash/issues

License¶ ↑

MIT

Authors¶ ↑

Jeremy Evans <code@jeremyevans.net>