Class: Rmodel::UniHash

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/rmodel/uni_hash.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash, key_op) ⇒ UniHash

Returns a new instance of UniHash.



3
4
5
6
# File 'lib/rmodel/uni_hash.rb', line 3

def initialize(hash, key_op)
  super(hash)
  @key_op = key_op
end

Instance Method Details

#[](key) ⇒ Object



8
9
10
# File 'lib/rmodel/uni_hash.rb', line 8

def [](key)
  super(key.public_send(@key_op))
end

#[]=(key, value) ⇒ Object



12
13
14
# File 'lib/rmodel/uni_hash.rb', line 12

def []=(key, value)
  super(key.public_send(@key_op), value)
end