D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
proc
/
thread-self
/
root
/
opt
/
alt
/
ruby18
/
share
/
ri
/
1.8
/
system
/
Set
/
Filename :
cdesc-Set.yaml
back
Copy
--- !ruby/object:RI::ClassDescription attributes: [] class_methods: - !ruby/object:RI::MethodSummary name: "[]" - !ruby/object:RI::MethodSummary name: new comment: - !ruby/struct:SM::Flow::P body: Set implements a collection of unordered values with no duplicates. This is a hybrid of Array's intuitive inter-operation facilities and Hash's fast lookup. - !ruby/struct:SM::Flow::P body: "Several methods accept any Enumerable object (implementing <tt>each</tt>) for greater flexibility: new, replace, merge, subtract, |, &, -, ^." - !ruby/struct:SM::Flow::P body: The equality of each couple of elements is determined according to Object#eql? and Object#hash, since Set uses Hash as storage. - !ruby/struct:SM::Flow::P body: Finally, if you are using class Set, you can also use Enumerable#to_set for convenience. - !ruby/struct:SM::Flow::H level: 2 text: Example - !ruby/struct:SM::Flow::VERB body: " require 'set'\n s1 = Set.new [1, 2] # -> #<Set: {1, 2}>\n s2 = [1, 2].to_set # -> #<Set: {1, 2}>\n s1 == s2 # -> true\n s1.add("foo") # -> #<Set: {1, 2, "foo"}>\n s1.merge([2, 6]) # -> #<Set: {6, 1, 2, "foo"}>\n s1.subset? s2 # -> false\n s2.subset? s1 # -> true\n" - !ruby/struct:SM::Flow::H level: 2 text: Contact - !ruby/struct:SM::Flow::VERB body: " - Akinori MUSHA <knu@iDaemons.org> (current maintainer)\n" constants: [] full_name: Set includes: - !ruby/object:RI::IncludedModule name: Enumerable instance_methods: - !ruby/object:RI::MethodSummary name: "&" - !ruby/object:RI::MethodSummary name: + - !ruby/object:RI::MethodSummary name: "-" - !ruby/object:RI::MethodSummary name: "<<" - !ruby/object:RI::MethodSummary name: == - !ruby/object:RI::MethodSummary name: ^ - !ruby/object:RI::MethodSummary name: add - !ruby/object:RI::MethodSummary name: add? - !ruby/object:RI::MethodSummary name: classify - !ruby/object:RI::MethodSummary name: clear - !ruby/object:RI::MethodSummary name: collect! - !ruby/object:RI::MethodSummary name: delete - !ruby/object:RI::MethodSummary name: delete? - !ruby/object:RI::MethodSummary name: delete_if - !ruby/object:RI::MethodSummary name: difference - !ruby/object:RI::MethodSummary name: divide - !ruby/object:RI::MethodSummary name: each - !ruby/object:RI::MethodSummary name: empty? - !ruby/object:RI::MethodSummary name: flatten - !ruby/object:RI::MethodSummary name: flatten! - !ruby/object:RI::MethodSummary name: flatten_merge - !ruby/object:RI::MethodSummary name: include? - !ruby/object:RI::MethodSummary name: initialize_copy - !ruby/object:RI::MethodSummary name: inspect - !ruby/object:RI::MethodSummary name: intersection - !ruby/object:RI::MethodSummary name: length - !ruby/object:RI::MethodSummary name: map! - !ruby/object:RI::MethodSummary name: member? - !ruby/object:RI::MethodSummary name: merge - !ruby/object:RI::MethodSummary name: proper_subset? - !ruby/object:RI::MethodSummary name: proper_superset? - !ruby/object:RI::MethodSummary name: reject! - !ruby/object:RI::MethodSummary name: replace - !ruby/object:RI::MethodSummary name: size - !ruby/object:RI::MethodSummary name: subset? - !ruby/object:RI::MethodSummary name: subtract - !ruby/object:RI::MethodSummary name: superset? - !ruby/object:RI::MethodSummary name: to_a - !ruby/object:RI::MethodSummary name: union - !ruby/object:RI::MethodSummary name: "|" name: Set superclass: Object