summaryrefslogtreecommitdiffstats
path: root/lib/ostruct.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-12 23:09:39 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-12 23:09:39 +0000
commit01701aabecb8dfbd8a75ab014c0d99ca3c4a26ab (patch)
tree6e5a90dde2b60164bc8cb2c6af97d994f0f7ea22 /lib/ostruct.rb
parent039573c5c2fd6eb2dd07aa152e4ef1d20d052a3c (diff)
downloadruby-01701aabecb8dfbd8a75ab014c0d99ca3c4a26ab.tar.gz
ruby-01701aabecb8dfbd8a75ab014c0d99ca3c4a26ab.tar.xz
ruby-01701aabecb8dfbd8a75ab014c0d99ca3c4a26ab.zip
* 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
Diffstat (limited to 'lib/ostruct.rb')
-rw-r--r--lib/ostruct.rb7
1 files changed, 4 insertions, 3 deletions
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