Class: Earl::HashInquirer
- Inherits:
-
Hash
- Object
- Hash
- Earl::HashInquirer
- Defined in:
- lib/earl/hash_inquirer.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(hash, &block) ⇒ HashInquirer
constructor
A new instance of HashInquirer.
- #method_missing(meth, *args, &block) ⇒ Object
Constructor Details
#initialize(hash, &block) ⇒ HashInquirer
Returns a new instance of HashInquirer.
3 4 5 6 |
# File 'lib/earl/hash_inquirer.rb', line 3 def initialize( hash, &block ) merge! hash super block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/earl/hash_inquirer.rb', line 8 def method_missing( meth, *args, &block ) if meth.to_s[ -1 ] == '?' self[ meth.to_s[ 0..-2 ].to_sym ] || false else super end end |