Method: Hash#method_missing
- Defined in:
- lib/nice/hash/add_to_ruby.rb
#method_missing(m, *arguments, &block) ⇒ Object
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/nice/hash/add_to_ruby.rb', line 179 def method_missing(m, *arguments, &block) m = m[1..-1].to_sym if m[0] == "_" if key?(m) self[m] elsif key?(m.to_s) self[m.to_s] elsif m.to_s[-1] == "=" if key?(m.to_s.chop) self[m.to_s.chop] = arguments[0] else self[m.to_s.chop.to_sym] = arguments[0] end else nil end end |