Class: HashWrapper

Inherits:
Hash
  • Object
show all
Defined in:
lib/hash_wrapper.rb

Instance Method Summary collapse

Instance Method Details

#[](subkey) ⇒ Object



9
10
11
# File 'lib/hash_wrapper.rb', line 9

def [](subkey)
  @hash[@key][subkey]
end

#[]=(subkey, obj) ⇒ Object



13
14
15
# File 'lib/hash_wrapper.rb', line 13

def []=(subkey, obj)
  @hash[@key][subkey] = obj
end

#init(hash, key) ⇒ Object



3
4
5
6
7
# File 'lib/hash_wrapper.rb', line 3

def init(hash, key)
  @hash = hash
  @key = key
  @hash[@key] ||= Hash.new
end