mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
b1e77e85b6
commit
cd63bec1ed
1 changed files with 11 additions and 6 deletions
11
lib/set.rb
11
lib/set.rb
|
@ -490,13 +490,18 @@ class Set
|
||||||
self
|
self
|
||||||
end
|
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:
|
# Used in case statements:
|
||||||
#
|
#
|
||||||
|
# require 'set'
|
||||||
|
#
|
||||||
# case :apple
|
# case :apple
|
||||||
# when Set[:potato, :carrot] then 'vegetable'
|
# when Set[:potato, :carrot]
|
||||||
# when Set[:apple, :banana] then 'fruit'
|
# "vegetable"
|
||||||
|
# when Set[:apple, :banana]
|
||||||
|
# "fruit"
|
||||||
# end
|
# end
|
||||||
# # => "fruit"
|
# # => "fruit"
|
||||||
#
|
#
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue