summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2021-06-18 08:24:45 -0700
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-07-29 14:18:25 +0900
commit52e602edda0aa61a83f558bcf9bfdd97a4fd107f (patch)
tree16b6f2e57b587e6c677725416e3a9f23c474db7a
parentcafa7d897554320b5194f5d71d6a3936f954b484 (diff)
[ruby/set] Update documentation for intersect?/disjoint?
https://github.com/ruby/set/commit/35b69e9d69
-rw-r--r--lib/set.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/set.rb b/lib/set.rb
index 8ed6e807c7..0179b52101 100644
--- a/lib/set.rb
+++ b/lib/set.rb
@@ -468,11 +468,13 @@ class Set
end
end
- # Returns true if the set and the given set have at least one
+ # Returns true if the set and the given enumerable have at least one
# element in common.
#
# Set[1, 2, 3].intersect? Set[4, 5] #=> false
# Set[1, 2, 3].intersect? Set[3, 4] #=> true
+ # Set[1, 2, 3].intersect? 4..5 #=> false
+ # Set[1, 2, 3].intersect? [3, 4] #=> true
def intersect?(set)
case set
when Set
@@ -488,11 +490,13 @@ class Set
end
end
- # Returns true if the set and the given set have no element in
- # common. This method is the opposite of `intersect?`.
+ # Returns true if the set and the given enumerable have
+ # no element in common. This method is the opposite of `intersect?`.
#
# Set[1, 2, 3].disjoint? Set[3, 4] #=> false
# Set[1, 2, 3].disjoint? Set[4, 5] #=> true
+ # Set[1, 2, 3].disjoint? [3, 4] #=> false
+ # Set[1, 2, 3].disjoint? 4..5 #=> true
def disjoint?(set)
!intersect?(set)
end