Class: ReadonlyHash
Overview
A very simple “readonly” hash implementation. Freezes itselfs on initialization so that any attempts to change will result in a TypeError
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash) ⇒ ReadonlyHash
constructor
A new instance of ReadonlyHash.
Methods inherited from Hash
Constructor Details
#initialize(hash) ⇒ ReadonlyHash
Returns a new instance of ReadonlyHash.
23 24 25 26 |
# File 'lib/settings_hash.rb', line 23 def initialize(hash) update hash freeze end |
Class Method Details
.[](*args) ⇒ Object
18 19 20 |
# File 'lib/settings_hash.rb', line 18 def [](*args) new(super(*args)) end |