summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-23 05:18:50 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-23 05:18:50 +0000
commit23de09d6bb2005efe55b08e90875ff6a6c6f8976 (patch)
treea0f94e856f9ced990fe93bdef985b08c3356bdcf /lib
parent8609df7b9a136e11b30ab70cb514ce53c17059ce (diff)
Merge from ruby_1_8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/mkmf.rb2
-rw-r--r--lib/set.rb12
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index ea4d680753..c9777fcc7b 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -1519,7 +1519,7 @@ static: $(STATIC_LIB)#{$extout ? " install-rb" : ""}
files.each do |f|
dest = "#{dir}/#{File.basename(f)}"
mfile.print("install-rb#{sfx}: #{dest}\n")
- mfile.print("#{dest}: #{f}\n\t$(#{$extout ? 'COPY' : 'INSTALL_DATA'}) ")
+ mfile.print("#{dest}: #{f} #{dir}\n\t$(#{$extout ? 'COPY' : 'INSTALL_DATA'}) ")
sep = config_string('BUILD_FILE_SEPARATOR')
if sep
f = f.gsub("/", sep)
diff --git a/lib/set.rb b/lib/set.rb
index 612ffd2d64..1d7232dd6c 100644
--- a/lib/set.rb
+++ b/lib/set.rb
@@ -2,7 +2,7 @@
#--
# set.rb - defines the Set class
#++
-# Copyright (c) 2002 Akinori MUSHA <knu@iDaemons.org>
+# Copyright (c) 2002-2008 Akinori MUSHA <knu@iDaemons.org>
#
# Documentation by Akinori MUSHA and Gavin Sinclair.
#
@@ -188,8 +188,10 @@ class Set
end
# Calls the given block once for each element in the set, passing
- # the element as parameter.
+ # the element as parameter. Returns an enumerator if no block is
+ # given.
def each
+ block_given? or return enum_for(__method__)
@hash.each_key { |o| yield(o) }
self
end
@@ -501,6 +503,7 @@ class SortedSet < Set
end
def each
+ block_given? or return enum_for(__method__)
to_a.each { |o| yield(o) }
end
@@ -918,9 +921,8 @@ class TC_Set < Test::Unit::TestCase
ary = [1,3,5,7,10,20]
set = Set.new(ary)
- assert_raises(LocalJumpError) {
- set.each
- }
+ e = set.each
+ assert_instance_of(Enumerable::Enumerator, e)
assert_nothing_raised {
set.each { |o|