Class Relax::SymbolicHash
In: lib/relax/symbolic_hash.rb
Parent: Hash

SymbolicHash provides an extension of Hash, but one that only supports keys that are symbols. This has been done in an effort to prevent the case where both a string key and a symbol key are set on the same hash, and espcially for dealing with this particular case when convert the hash to a string.

Example

  hash = Relax::SymbolicHash.new
  hash[:one] = 1
  hash['one'] = 2
  puts hash[:one] # => 2

Credits

Some of the inspiration (and code) for this class comes from the HashWithIndifferentAccess that ships with Rails.

Methods

[]   []=   convert_key   convert_value   delete   dup   fetch   has_key?   include?   key?   member?   merge   merge!   new   update   values_at  

Public Class methods

Public Instance methods

has_key?(key)

Alias for key?

include?(key)

Alias for key?

member?(key)

Alias for key?

merge!(other_hash)

Alias for update

Protected Instance methods

[Validate]