Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/hash_fix.rb
Overview
Copyright © 2010, Cohesive Flexible Technologies, Inc. This copyrighted material is the property of Cohesive Flexible Technologies and is subject to the license terms of the product it is contained within, whether in text or compiled form. It is licensed under the terms expressed in the accompanying README and LICENSE files.
This program is AS IS and WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/hash_fix.rb', line 25 def method_missing(meth, *args, &block) if args.size == 0 dashed = meth.to_s.gsub(/_/, '-') self[meth] || self[dashed] || self[dashed.to_sym] || super(meth, *args, &block) rescue nil end end |