Class: Cistern::Data::Hash
- Inherits:
-
Object
- Object
- Cistern::Data::Hash
- Defined in:
- lib/cistern/data/hash.rb
Instance Method Summary collapse
- #clear ⇒ Object
- #fetch(key, *args) ⇒ Object (also: #[])
-
#initialize(_options = {}, &default) ⇒ Hash
constructor
A new instance of Hash.
- #store(key, *args) ⇒ Object (also: #[]=)
Constructor Details
#initialize(_options = {}, &default) ⇒ Hash
Returns a new instance of Hash.
6 7 8 9 |
# File 'lib/cistern/data/hash.rb', line 6 def initialize( = {}, &default) @hash = {} @default = default end |
Instance Method Details
#clear ⇒ Object
11 12 13 |
# File 'lib/cistern/data/hash.rb', line 11 def clear hash.clear end |
#fetch(key, *args) ⇒ Object Also known as: []
23 24 25 26 27 |
# File 'lib/cistern/data/hash.rb', line 23 def fetch(key, *args) assign_default(key) hash.fetch(key, *args) end |
#store(key, *args) ⇒ Object Also known as: []=
15 16 17 18 19 |
# File 'lib/cistern/data/hash.rb', line 15 def store(key, *args) assign_default(key) hash.store(key, *args) end |