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.
4 5 6 7 |
# File 'lib/cistern/data/hash.rb', line 4 def initialize( = {}, &default) @hash = {} @default = default end |
Instance Method Details
#clear ⇒ Object
9 10 11 |
# File 'lib/cistern/data/hash.rb', line 9 def clear hash.clear end |
#fetch(key, *args) ⇒ Object Also known as: []
21 22 23 24 25 |
# File 'lib/cistern/data/hash.rb', line 21 def fetch(key, *args) assign_default(key) hash.fetch(key, *args) end |
#store(key, *args) ⇒ Object Also known as: []=
13 14 15 16 17 |
# File 'lib/cistern/data/hash.rb', line 13 def store(key, *args) assign_default(key) hash.store(key, *args) end |