ruby-changes:22706
From: marcandre <ko1@a...>
Date: Thu, 23 Feb 2012 03:59:30 +0900 (JST)
Subject: [ruby-changes:22706] marcandRe: r34755 (trunk): * lib/ostruct.rb (delete_field): Bug fix so previous value is returned.
marcandre 2012-02-23 03:59:03 +0900 (Thu, 23 Feb 2012) New Revision: 34755 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34755 Log: * 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 Modified files: trunk/ChangeLog trunk/lib/ostruct.rb trunk/test/ostruct/test_ostruct.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 34754) +++ ChangeLog (revision 34755) @@ -1,3 +1,8 @@ +Thu Feb 23 03:58:08 2012 Marc-Andre Lafortune <ruby-core@m...> + + * 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@r...> * io.c (rb_io_extract_modeenc): fail only if conflicting Index: lib/ostruct.rb =================================================================== --- lib/ostruct.rb (revision 34754) +++ lib/ostruct.rb (revision 34755) @@ -190,8 +190,8 @@ # def delete_field(name) sym = name.to_sym + singleton_class.__send__(:remove_method, sym, "#{name}=") @table.delete sym - singleton_class.__send__(:remove_method, sym, "#{name}=") end InspectKey = :__inspect_key__ # :nodoc: Index: test/ostruct/test_ostruct.rb =================================================================== --- test/ostruct/test_ostruct.rb (revision 34754) +++ test/ostruct/test_ostruct.rb (revision 34755) @@ -57,9 +57,10 @@ o.a = '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_equal(a, 'a') end def test_method_missing_handles_square_bracket_equals -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/