From 01701aabecb8dfbd8a75ab014c0d99ca3c4a26ab Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 12 Sep 2005 23:09:39 +0000 Subject: * 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: http://svn.ruby-lang.org/repos/ruby/trunk@9138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/ostruct.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/ostruct.rb b/lib/ostruct.rb index 6af5bbdac..f3ed01524 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 -- cgit