summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMaxim Filimonov <tpaktopsp@gmail.com>2013-07-21 15:25:25 +1000
committerMaxim Filimonov <tpaktopsp@gmail.com>2013-07-21 15:25:25 +1000
commita21eea9c476d3bac4bf51d9069bc9f2d34dc9e80 (patch)
tree8d4ece7463592a1fd085de461c513c5ffcc6aa41 /lib
parentbde56b72375dfbd6198dfdfa2fc7e2f86d50ba11 (diff)
downloadhashie-a21eea9c476d3bac4bf51d9069bc9f2d34dc9e80.tar.gz
Reuse suffixes constant for method missing suffixes search
Diffstat (limited to 'lib')
-rw-r--r--lib/hashie/mash.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/hashie/mash.rb b/lib/hashie/mash.rb
index 84830c1..c987714 100644
--- a/lib/hashie/mash.rb
+++ b/lib/hashie/mash.rb
@@ -200,7 +200,8 @@ module Hashie
def method_missing(method_name, *args, &blk)
return self.[](method_name, &blk) if key?(method_name)
- match = method_name.to_s.match(/(.*?)([?=!_]?)$/)
+ suffixes_regex = ALLOWED_SUFFIXES.join
+ match = method_name.to_s.match(/(.*?)([#{suffixes_regex}]?)$/)
case match[2]
when "="
self[match[1]] = args.first