Class: Earl::HashInquirer

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

Direct Known Subclasses

URL

Instance Method Summary collapse

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