diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-04-14 03:35:18 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-04-14 03:35:18 +0000 |
commit | da4942c9d7924dcfad7d0977ce80f701c46fbdca (patch) | |
tree | 3d32632beff403da7a8a93ddf1c2c6e025cd3f4b /lib/ostruct.rb | |
parent | 2df3e8de58db7b1df5937f6faf641f354a507f7c (diff) | |
download | ruby-da4942c9d7924dcfad7d0977ce80f701c46fbdca.tar.gz |
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
Diffstat (limited to 'lib/ostruct.rb')
-rw-r--r-- | lib/ostruct.rb | 3 |
1 files changed, 1 insertions, 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 |