ruby-changes:7053
From: knu <ko1@a...>
Date: Wed, 13 Aug 2008 17:03:49 +0900 (JST)
Subject: [ruby-changes:7053] Ruby:r18571 (trunk): * golf_prelude.rb, lib/set.rb (TC_Set#test_each),
knu 2008-08-13 17:03:30 +0900 (Wed, 13 Aug 2008) New Revision: 18571 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18571 Log: * golf_prelude.rb, lib/set.rb (TC_Set#test_each), test/readline/test_readline_history.rb (Readline#test_each__enumerator), test/ruby/test_array.rb (TestArray#test_collect), test/ruby/test_enumerator.rb (TestEnumerator#test_initialize): Enumerable::Enumerator is now called Enumerator. * lib/rinda/tuplespace.rb (Rinda::TupleBag#initialize): Use enum_for instead of hardcoding Enumerable::Enumerator. Modified files: trunk/ChangeLog trunk/ext/readline/README.ja trunk/golf_prelude.rb trunk/lib/rinda/tuplespace.rb trunk/lib/set.rb trunk/test/readline/test_readline_history.rb trunk/test/ruby/test_array.rb trunk/test/ruby/test_enumerator.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 18570) +++ ChangeLog (revision 18571) @@ -1,3 +1,14 @@ +Wed Aug 13 17:01:36 2008 Akinori MUSHA <knu@i...> + + * golf_prelude.rb, lib/set.rb (TC_Set#test_each), + test/readline/test_readline_history.rb (Readline#test_each__enumerator), + test/ruby/test_array.rb (TestArray#test_collect), + test/ruby/test_enumerator.rb (TestEnumerator#test_initialize): + Enumerable::Enumerator is now called Enumerator. + + * lib/rinda/tuplespace.rb (Rinda::TupleBag#initialize): Use + enum_for instead of hardcoding Enumerable::Enumerator. + Wed Aug 13 16:40:57 2008 Koichi Sasada <ko1@a...> * thread.c, vm_core.h: add manual priority support Index: lib/set.rb =================================================================== --- lib/set.rb (revision 18570) +++ lib/set.rb (revision 18571) @@ -941,7 +941,7 @@ assert_same(set, ret) e = set.each - assert_instance_of(Enumerable::Enumerator, e) + assert_instance_of(Enumerator, e) assert_nothing_raised { set.each { |o| Index: lib/rinda/tuplespace.rb =================================================================== --- lib/rinda/tuplespace.rb (revision 18570) +++ lib/rinda/tuplespace.rb (revision 18571) @@ -315,7 +315,7 @@ def initialize # :nodoc: @hash = {} - @enum = Enumerable::Enumerator.new(self, :each_entry) + @enum = enum_for(:each_entry) end ## Index: ext/readline/README.ja =================================================================== --- ext/readline/README.ja (revision 18570) +++ ext/readline/README.ja (revision 18571) @@ -385,7 +385,7 @@ * HISTORY << string -> self * HISTORY.pop -> string * HISTORY.shift -> string - * HISTORY.each -> Enumerable::Enumerator + * HISTORY.each -> Enumerator * HISTORY.each { |i| } -> [string] * HISTORY.length -> Integer * HISTORY.empty? -> true or false Index: golf_prelude.rb =================================================================== --- golf_prelude.rb (revision 18570) +++ golf_prelude.rb (revision 18571) @@ -84,7 +84,7 @@ replace(a.join) if result.class == Array Integer===result[0] ? result.pack('c*') : result.join - elsif result.class == Enumerable::Enumerator + elsif result.class == Enumerator result.map(&:join).to_enum else result @@ -93,7 +93,7 @@ } end -class Enumerable::Enumerator +class Enumerator alias old_to_s to_s (Array.instance_methods-instance_methods-[:replace]+[:to_s]).each{|meth| eval"def #{meth}(*args, &block) Index: test/ruby/test_enumerator.rb =================================================================== --- test/ruby/test_enumerator.rb (revision 18570) +++ test/ruby/test_enumerator.rb (revision 18571) @@ -57,8 +57,8 @@ def test_initialize assert_equal([1, 2, 3], @obj.to_enum(:foo, 1, 2, 3).to_a) - assert_equal([1, 2, 3], Enumerable::Enumerator.new(@obj, :foo, 1, 2, 3).to_a) - assert_raise(ArgumentError) { Enumerable::Enumerator.new } + assert_equal([1, 2, 3], Enumerator.new(@obj, :foo, 1, 2, 3).to_a) + assert_raise(ArgumentError) { Enumerator.new } end def test_initialize_copy Index: test/ruby/test_array.rb =================================================================== --- test/ruby/test_array.rb (revision 18570) +++ test/ruby/test_array.rb (revision 18571) @@ -479,7 +479,7 @@ # Ruby 1.9 feature change: # Enumerable#collect without block returns an Enumerator. #assert_equal([1, 2, 3], @cls[1, 2, 3].collect) - assert_kind_of Enumerable::Enumerator, @cls[1, 2, 3].collect + assert_kind_of Enumerator, @cls[1, 2, 3].collect end # also update map! Index: test/readline/test_readline_history.rb =================================================================== --- test/readline/test_readline_history.rb (revision 18570) +++ test/readline/test_readline_history.rb (revision 18571) @@ -219,7 +219,7 @@ def test_each__enumerator e = HISTORY.each - assert_instance_of(Enumerable::Enumerator, e) + assert_instance_of(Enumerator, e) end def test_length -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/