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:
parent
2df3e8de58
commit
da4942c9d7
1 changed files with 1 additions and 2 deletions
|
@ -174,9 +174,8 @@ class OpenStruct
|
||||||
protected :new_ostruct_member
|
protected :new_ostruct_member
|
||||||
|
|
||||||
def method_missing(mid, *args) # :nodoc:
|
def method_missing(mid, *args) # :nodoc:
|
||||||
mname = mid.id2name
|
|
||||||
len = args.length
|
len = args.length
|
||||||
if mname.chomp!('=')
|
if mname = mid[/.*(?==\z)/m]
|
||||||
if len != 1
|
if len != 1
|
||||||
raise ArgumentError, "wrong number of arguments (#{len} for 1)", caller(1)
|
raise ArgumentError, "wrong number of arguments (#{len} for 1)", caller(1)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue