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:
parent
3f3ad7e4d5
commit
064f07ace5
1 changed files with 3 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue