Class: SoloHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/solo-rails.rb

Overview

Allows object.fieldname searches, returning nil rather than exception if key does not exist - PG 2011-01-20

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *params) ⇒ Object



278
279
280
281
282
# File 'lib/solo-rails.rb', line 278

def method_missing(method, *params)  
  method = method.to_sym  
  return self[method] if self.keys.collect(&:to_sym).include?(method)   
  nil
end