1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2015-04-14 03:35:18 +00:00
parent 2df3e8de58
commit da4942c9d7

View file

@ -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