Class: MethodedHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/ruby/extensions/methoded_hash.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(h = {}) ⇒ MethodedHash

Returns a new instance of MethodedHash.



3
4
5
6
# File 'lib/ruby/extensions/methoded_hash.rb', line 3

def initialize(h = {})
  duplicate_hash(h)
  self
end

Class Method Details

.create(h = {}) ⇒ Object

create(h = {})

create force-creates a MethodedHash class, avoiding potential conflicts with children classes. However it can be overridden by children classes if needed.



55
56
57
# File 'lib/ruby/extensions/methoded_hash.rb', line 55

def create(h = {})
  MethodedHash.new(h)
end

Instance Method Details

#[]=(key, value) ⇒ Object



8
9
10
11
# File 'lib/ruby/extensions/methoded_hash.rb', line 8

def []=(key, value)
  common_methodizer(key)
  super
end