aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorstomar <stomar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-29 20:59:33 +0000
committerstomar <stomar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-29 20:59:33 +0000
commitf68741e186b8827dbeef47a29e5a7f108d6859f2 (patch)
tree3f65187399a7931a8934dd76c0bb97d76d57ecec /lib
parent8e65301b5424f5186ee635a089431c428cacccf9 (diff)
downloadruby-f68741e186b8827dbeef47a29e5a7f108d6859f2.tar.gz
lib/set.rb: improve docs for Set#===
* lib/set.rb: [DOC] improve description and examples for Set#===. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/set.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/set.rb b/lib/set.rb
index 5da196d1e0..fb82c105cb 100644
--- a/lib/set.rb
+++ b/lib/set.rb
@@ -490,20 +490,25 @@ class Set
self
end
- # Returns true if obj is a member of the set, and false otherwise.
+ # Returns true if the given object is a member of the set,
+ # and false otherwise.
#
# Used in case statements:
#
+ # require 'set'
+ #
# case :apple
- # when Set[:potato, :carrot] then 'vegetable'
- # when Set[:apple, :banana] then 'fruit'
+ # when Set[:potato, :carrot]
+ # "vegetable"
+ # when Set[:apple, :banana]
+ # "fruit"
# end
- # #=> "fruit"
+ # # => "fruit"
#
# Or by itself:
#
- # Set[1, 2, 3] === 2 #=> true
- # Set[1, 2, 3] === 4 #=> false
+ # Set[1, 2, 3] === 2 # => true
+ # Set[1, 2, 3] === 4 # => false
#
alias === include?