зеркало из https://github.com/github/ruby.git
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:
Родитель
2df3e8de58
Коммит
da4942c9d7
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче