diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-12 23:09:39 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-12 23:09:39 +0000 |
commit | ef1ccbbc40cbfa512b2be0eeb7793c3532ff5e20 (patch) | |
tree | 6e5a90dde2b60164bc8cb2c6af97d994f0f7ea22 /lib | |
parent | 40816e8ba28ffd52e6e02a258a8819cb288ab713 (diff) | |
download | ruby-ef1ccbbc40cbfa512b2be0eeb7793c3532ff5e20.tar.gz |
* lib/ostruct.rb (new_ostruct_member): Object#send no longer call
private methods. [ruby-dev:27044]
* test/rss/test_dublincore.rb, test/rss/test_trackback.rb,
test/ruby/test_eval.rb, test/socket/test_socket.rb: ditto.
* test/ruby/test_lambda (test_call_with_block): lambda makes new scope
for formal block parameter.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ostruct.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/ostruct.rb b/lib/ostruct.rb index 6af5bbdac0..f3ed01524b 100644 --- a/lib/ostruct.rb +++ b/lib/ostruct.rb @@ -70,9 +70,10 @@ class OpenStruct def new_ostruct_member(name) name = name.to_sym unless self.respond_to?(name) - meta = class << self; self; end - meta.send(:define_method, name) { @table[name] } - meta.send(:define_method, :"#{name}=") { |x| @table[name] = x } + class << self; self; end.class_eval do + define_method(name) { @table[name] } + define_method(:"#{name}=") { |x| @table[name] = x } + end end end |