aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ostruct.rb
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-31 05:37:21 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-31 05:37:21 +0000
commitb8ef3bcddbf0fc48902ce3fabd4408c45c3fe996 (patch)
tree99f8057a25387d3cf7ec58a6fd53cb41bda03b2b /lib/ostruct.rb
parent01422ed265374d8852f180bdef298e855eb09535 (diff)
downloadruby-b8ef3bcddbf0fc48902ce3fabd4408c45c3fe996.tar.gz
* lib/ostruct.rb: Fix new_ostruct_member to correctly avoid redefinition
[#11901] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/ostruct.rb')
-rw-r--r--lib/ostruct.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ostruct.rb b/lib/ostruct.rb
index e7b8ed4609..e5b69608ad 100644
--- a/lib/ostruct.rb
+++ b/lib/ostruct.rb
@@ -168,7 +168,7 @@ class OpenStruct
#
def new_ostruct_member(name)
name = name.to_sym
- unless respond_to?(name)
+ unless singleton_class.method_defined?(name)
define_singleton_method(name) { @table[name] }
define_singleton_method("#{name}=") { |x| modifiable[name] = x }
end