diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-09-07 10:58:02 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-09-07 10:58:02 +0000 |
commit | e1488bd2435bb6b691f0f12220c9a017c8e0823f (patch) | |
tree | 66a52789a38d0e70b578ce0ace19b5943b8ecd6d /lib/set.rb | |
parent | d29143b99ea0fb2ea4821a804d489447cf92ed68 (diff) | |
download | bundler-e1488bd2435bb6b691f0f12220c9a017c8e0823f.tar.gz |
Use Enumerable#all? to optimize a bit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/set.rb')
-rw-r--r-- | lib/set.rb | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/set.rb b/lib/set.rb index 374b43da3f..edd219b34d 100644 --- a/lib/set.rb +++ b/lib/set.rb @@ -263,8 +263,7 @@ class Set def contain?(enum) enum.is_a?(Enumerable) or raise ArgumentError, "value must be enumerable" - enum.each { |o| include?(o) or return false } - true + enum.all? { |o| include?(o) } end def each @@ -338,9 +337,7 @@ class Set set.is_a?(Set) && size == set.size or return false - set.each { |o| include?(o) or return false } - - true + set.all? { |o| include?(o) } end def hash |