WriteOnceHash (Class)

In: basiclibrary.rb
Parent: Hash

A Hash object which raises an error if any previously-defined key attempts to be set again.

   foo = WriteOnceHash.new
   foo['name'] = 'Gavin'    => 'Gavin'
   foo['age']  = 31         => 31
   foo['name'] = 'Bob'
   => Error: WriteOnceHash has a value for key 'name' in object:
      {"name"=>"Gavin", "age"=>31} (RuntimeError)

Methods

[]=  

Public Instance methods

Set a value for a key; raises an error if that key already exists with a different value.

[Validate]