1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Correct descriptions of {proper_,}{superset,subset}?.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
knu 2003-01-21 15:15:26 +00:00
parent 3f3ad7e4d5
commit 064f07ace5

View file

@ -146,23 +146,21 @@ class Set
end
alias member? include?
# Returns true if the set is a superset of or is equal to the given
# set.
# Returns true if the set is a superset of the given set.
def superset?(set)
set.is_a?(Set) or raise ArgumentError, "value must be a set"
return false if size < set.size
set.all? { |o| include?(o) }
end
# Returns true if the set is a superset of or is equal to the given
# set.
# Returns true if the set is a proper superset of the given set.
def proper_superset?(set)
set.is_a?(Set) or raise ArgumentError, "value must be a set"
return false if size <= set.size
set.all? { |o| include?(o) }
end
# Returns true if the set is a proper subset of the given set.
# Returns true if the set is a subset of the given set.
def subset?(set)
set.is_a?(Set) or raise ArgumentError, "value must be a set"
return false if set.size < size