21 lines
385 B
Plaintext
21 lines
385 B
Plaintext
= StaticHash
|
|
|
|
A StaticHash is simply a Hash that can only be assigned
|
|
once per key. Once assigned a subsequent attempt to assign
|
|
a value to the same key will raise an ArgumentError.
|
|
|
|
h = StaticHash.new
|
|
|
|
h["x"] = 1
|
|
|
|
expect ArgumentError do
|
|
h["x"] = 2
|
|
end
|
|
|
|
The same error will be raised when using #update or #merge!.
|
|
|
|
expect ArgumentError do
|
|
h.update( "x"=>3 )
|
|
end
|
|
|