Module: HashGleaner
  
  
  
  
  
  
  
  
  
  
  
  
    - Defined in:
- lib/hash_gleaner.rb,
 lib/hash_gleaner/list.rb,
 lib/hash_gleaner/missing_keys.rb,
 lib/hash_gleaner/value_gleaner.rb
 
Defined Under Namespace
  
    
      Modules: InstanceMethods
    
  
    
      Classes: Empty, List, MissingKeys, MissingKeysException, ValueGleaner
    
  
  
    
      Class Method Summary
      collapse
    
    
  
  
    Class Method Details
    
      
  
  
    .apply(hash, proc = nil, &block)  ⇒ Object 
  
  
  
  
    | 
11
12
13
14
15
16
17 | # File 'lib/hash_gleaner.rb', line 11
def apply(hash, proc=nil, &block)
  missing_keys = MissingKeys.new
  action = (block if block_given?) || (proc if proc.is_a? Proc)
  h = List.new(hash, missing_keys).instance_eval(&action) if action
  raise MissingKeysException.new(missing_keys) if missing_keys.has_keys?
  h
end | 
 
    
      
  
  
    .included(base)  ⇒ Object 
  
  
  
  
    | 
7
8
9 | # File 'lib/hash_gleaner.rb', line 7
def included(base)
  base.__send__ :include, InstanceMethods
end |