summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-27 15:37:55 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-27 15:37:55 +0000
commite3defadb7808f829c193e9d0842405cafca41ec4 (patch)
treea8b0659fcb37beb5e9f02ac8eb33fcea493f616c /lib
parent5194682b72d88304b29e7d083e582b2fc8d36073 (diff)
merge revision(s) 58077: [Backport #13358]
ostruct.rb: fix OpenStruct.allocate * lib/ostruct.rb (OpenStruct.allocate): initialize an instance variable directly, without calling `intialize` method which may be overridden in a subclass. [ruby-core:80292] [Bug #13358] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@58161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/ostruct.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ostruct.rb b/lib/ostruct.rb
index 17efcdc8d3..bae0f3aac5 100644
--- a/lib/ostruct.rb
+++ b/lib/ostruct.rb
@@ -73,7 +73,10 @@
class OpenStruct
# :nodoc:
class << self
- alias allocate new
+ def allocate
+ (x = super).instance_variable_set(:@table, {})
+ x
+ end
end
#