mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/ostruct.rb (delete_field): Bug fix so previous value is returned.
Patch by Nick Recobra [Bug #6063] * test/ostruct/test_ostruct.rb: Test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9c8d348d49
commit
dfb1a71222
3 changed files with 8 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Thu Feb 23 03:58:08 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
|
||||||
|
|
||||||
|
* lib/ostruct.rb (delete_field): Bug fix so previous value is
|
||||||
|
returned. Patch by Nick Recobra [Bug #6063]
|
||||||
|
|
||||||
Thu Feb 23 02:33:00 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Thu Feb 23 02:33:00 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* io.c (rb_io_extract_modeenc): fail only if conflicting
|
* io.c (rb_io_extract_modeenc): fail only if conflicting
|
||||||
|
|
|
@ -190,8 +190,8 @@ class OpenStruct
|
||||||
#
|
#
|
||||||
def delete_field(name)
|
def delete_field(name)
|
||||||
sym = name.to_sym
|
sym = name.to_sym
|
||||||
@table.delete sym
|
|
||||||
singleton_class.__send__(:remove_method, sym, "#{name}=")
|
singleton_class.__send__(:remove_method, sym, "#{name}=")
|
||||||
|
@table.delete sym
|
||||||
end
|
end
|
||||||
|
|
||||||
InspectKey = :__inspect_key__ # :nodoc:
|
InspectKey = :__inspect_key__ # :nodoc:
|
||||||
|
|
|
@ -57,9 +57,10 @@ class TC_OpenStruct < Test::Unit::TestCase
|
||||||
o.a = 'a'
|
o.a = 'a'
|
||||||
assert_respond_to(o, :a)
|
assert_respond_to(o, :a)
|
||||||
assert_respond_to(o, :a=)
|
assert_respond_to(o, :a=)
|
||||||
o.delete_field :a
|
a = o.delete_field :a
|
||||||
assert_not_respond_to(o, :a, bug)
|
assert_not_respond_to(o, :a, bug)
|
||||||
assert_not_respond_to(o, :a=, bug)
|
assert_not_respond_to(o, :a=, bug)
|
||||||
|
assert_equal(a, 'a')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_method_missing_handles_square_bracket_equals
|
def test_method_missing_handles_square_bracket_equals
|
||||||
|
|
Loading…
Add table
Reference in a new issue