зеркало из https://github.com/github/ruby.git
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
16612b360b
Коммит
d4b7cc796c
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
Wed Aug 13 17:01:36 2008 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* 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@atdot.net>
|
||||
|
||||
* thread.c, vm_core.h: add manual priority support
|
||||
|
|
|
@ -385,7 +385,7 @@ HISTORY
|
|||
* 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
|
||||
|
|
|
@ -84,7 +84,7 @@ class String
|
|||
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 @@ class String
|
|||
}
|
||||
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)
|
||||
|
|
|
@ -315,7 +315,7 @@ module Rinda
|
|||
|
||||
def initialize # :nodoc:
|
||||
@hash = {}
|
||||
@enum = Enumerable::Enumerator.new(self, :each_entry)
|
||||
@enum = enum_for(:each_entry)
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
@ -941,7 +941,7 @@ class TC_Set < Test::Unit::TestCase
|
|||
assert_same(set, ret)
|
||||
|
||||
e = set.each
|
||||
assert_instance_of(Enumerable::Enumerator, e)
|
||||
assert_instance_of(Enumerator, e)
|
||||
|
||||
assert_nothing_raised {
|
||||
set.each { |o|
|
||||
|
|
|
@ -219,7 +219,7 @@ class Readline::TestHistory < Test::Unit::TestCase
|
|||
|
||||
def test_each__enumerator
|
||||
e = HISTORY.each
|
||||
assert_instance_of(Enumerable::Enumerator, e)
|
||||
assert_instance_of(Enumerator, e)
|
||||
end
|
||||
|
||||
def test_length
|
||||
|
|
|
@ -479,7 +479,7 @@ class TestArray < Test::Unit::TestCase
|
|||
# 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!
|
||||
|
|
|
@ -57,8 +57,8 @@ class TestEnumerator < Test::Unit::TestCase
|
|||
|
||||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче