Class: Hash::Accessible

Inherits:
Indifferent show all
Defined in:
lib/hash_ext/accessible.rb

Method Summary

Methods inherited from Indifferent

#[], #[]=, #delete, #fetch, #initialize, #key?, #merge, #update

Constructor Details

This class inherits a constructor from Hash::Indifferent

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object (private)



6
7
8
9
10
11
12
13
# File 'lib/hash_ext/accessible.rb', line 6

def method_missing(method, *args, &block)
  if method.to_s.end_with? '='
    key = method[0..-2]
    self[key] = make_accessible args[0]
  else
    make_accessible self[method]
  end
end