From da4942c9d7924dcfad7d0977ce80f701c46fbdca Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 14 Apr 2015 03:35:18 +0000 Subject: [PATCH] ostruct.rb: match Symbol itself * lib/ostruct.rb (method_missing): get rid of creating temporary string object for method name, match Symbol itself. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/ostruct.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/ostruct.rb b/lib/ostruct.rb index f51eb7b5db..35047f1cff 100644 --- a/lib/ostruct.rb +++ b/lib/ostruct.rb @@ -174,9 +174,8 @@ class OpenStruct protected :new_ostruct_member def method_missing(mid, *args) # :nodoc: - mname = mid.id2name len = args.length - if mname.chomp!('=') + if mname = mid[/.*(?==\z)/m] if len != 1 raise ArgumentError, "wrong number of arguments (#{len} for 1)", caller(1) end