зеркало из https://github.com/github/ruby.git
ostruct.rb: respond_to?
* lib/ostruct.rb (OpenStruct): make respond_to? working on just-allocated objects for workaround of Psych. [ruby-core:72501] [Bug #11884] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
88aa6abf9c
Коммит
15960b37e8
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
Tue Dec 29 12:48:34 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/ostruct.rb (OpenStruct): make respond_to? working on
|
||||
just-allocated objects for workaround of Psych.
|
||||
[ruby-core:72501] [Bug #11884]
|
||||
|
||||
Tue Dec 29 12:46:13 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/ostruct.rb (OpenStruct): make respond_to? working on
|
||||
just-allocated objects for workaround of Psych.
|
||||
[ruby-core:72501] [Bug #11884]
|
||||
|
||||
Tue Dec 29 10:35:00 2015 Kenta Murata <mrkn@mrkn.jp>
|
||||
|
||||
* test/mkmf/test_have_func.rb (test_have_func):
|
||||
|
|
|
@ -71,6 +71,11 @@
|
|||
# of these properties compared to using a Hash or a Struct.
|
||||
#
|
||||
class OpenStruct
|
||||
# :nodoc:
|
||||
class << self
|
||||
alias allocate new
|
||||
end
|
||||
|
||||
#
|
||||
# Creates a new OpenStruct object. By default, the resulting OpenStruct
|
||||
# object will have no attributes.
|
||||
|
|
|
@ -23,6 +23,10 @@ class TC_OpenStruct < Test::Unit::TestCase
|
|||
assert_respond_to(o, :a=)
|
||||
end
|
||||
|
||||
def test_respond_to_allocated
|
||||
assert_not_respond_to(OpenStruct.allocate, :a)
|
||||
end
|
||||
|
||||
def test_equality
|
||||
o1 = OpenStruct.new
|
||||
o2 = OpenStruct.new
|
||||
|
|
Загрузка…
Ссылка в новой задаче