Skip to content

Commit

Permalink
* golf_prelude.rb, lib/set.rb (TC_Set#test_each),
Browse files Browse the repository at this point in the history
  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
  • Loading branch information
knu committed Aug 13, 2008
1 parent 16612b3 commit d4b7cc7
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 9 deletions.
11 changes: 11 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
Wed Aug 13 17:01:36 2008 Akinori MUSHA <[email protected]>

* 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 <[email protected]>

* thread.c, vm_core.h: add manual priority support
Expand Down
2 changes: 1 addition & 1 deletion ext/readline/README.ja
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions golf_prelude.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def to_a
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
Expand All @@ -93,7 +93,7 @@ def to_a
}
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)
Expand Down
2 changes: 1 addition & 1 deletion lib/rinda/tuplespace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def find(&blk)

def initialize # :nodoc:
@hash = {}
@enum = Enumerable::Enumerator.new(self, :each_entry)
@enum = enum_for(:each_entry)
end

##
Expand Down
2 changes: 1 addition & 1 deletion lib/set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ def test_each
assert_same(set, ret)

e = set.each
assert_instance_of(Enumerable::Enumerator, e)
assert_instance_of(Enumerator, e)

assert_nothing_raised {
set.each { |o|
Expand Down
2 changes: 1 addition & 1 deletion test/readline/test_readline_history.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def test_each

def test_each__enumerator
e = HISTORY.each
assert_instance_of(Enumerable::Enumerator, e)
assert_instance_of(Enumerator, e)
end

def test_length
Expand Down
2 changes: 1 addition & 1 deletion test/ruby/test_array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def test_collect
# 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!
Expand Down
4 changes: 2 additions & 2 deletions test/ruby/test_enumerator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def (o = Object.new).each

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
Expand Down

0 comments on commit d4b7cc7

Please sign in to comment.