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



265
266
267
268
269
# File 'lib/solo-rails.rb', line 265

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