Skip to content

Commit

Permalink
Reuse suffixes constant for method missing suffixes search
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxim-Filimonov committed Jul 21, 2013
1 parent bde56b7 commit a21eea9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/hashie/mash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ def prefix_method?(method_name)

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
Expand Down

0 comments on commit a21eea9

Please sign in to comment.