This commit is contained in:
1 parent
c8ac4fcae5
commit
4cee170d66
17576 files changed
+895740
-2
No files matched your search
@@ -0,0 +1,20 @@
|
||||
= 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
|
||||
|
||||
Reference in new issue
Block a user