📁 File Manager Pro
v10.0.3 | PHP: 8.1.34
Server: Apache
2026-06-22 17:48:17
📂
/ (Root)
/
opt
/
alt
/
ruby27
/
share
/
ri
/
system
/
Set
📍 /opt/alt/ruby27/share/ri/system/Set
🔄 Refresh
✏️
Editing: cdesc-Set.ri
Read Only
U:RDoc::NormalClass[iI"Set:ET@I"Object;To:RDoc::Markup::Document:@parts[o;;[ : @fileI"!ext/json/lib/json/add/set.rb;T:0@omit_headings_from_table_of_contents_below0o;;[o:RDoc::Markup::Paragraph;[I"ISet implements a collection of unordered values with no duplicates. ;TI"JThis is a hybrid of Array's intuitive inter-operation facilities and ;TI"Hash's fast lookup.;To:RDoc::Markup::BlankLine o;;[ I"GSet is easy to use with Enumerable objects (implementing +each+). ;TI"IMost of the initializer methods and binary operators accept generic ;TI"GEnumerable objects besides sets and arrays. An Enumerable object ;TI"7can be converted to Set using the +to_set+ method.;T@o;;[I"ESet uses Hash as storage, so you must note the following points:;T@o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;[o;;[I"EEquality of elements is determined according to Object#eql? and ;TI"EObject#hash. Use Set#compare_by_identity to make a set compare ;TI"$its elements by their identity.;To;;0;[o;;[I"CSet assumes that the identity of each element does not change ;TI"Hwhile it is stored. Modifying an element of a set will render the ;TI" set to an unreliable state.;To;;0;[o;;[I"CWhen a string is to be stored, a frozen copy of the string is ;TI"Astored instead unless the original string is already frozen.;T@S:RDoc::Markup::Heading: leveli: textI"Comparison;T@o;;[ I"BThe comparison operators <, >, <=, and >= are implemented as ;TI"Hshorthand for the {proper_,}{subset?,superset?} methods. However, ;TI"Jthe <=> operator is intentionally left out because not every pair of ;TI"8sets is comparable ({x, y} vs. {x, z} for example).;T@S;;i;I"Example;T@o:RDoc::Markup::Verbatim;[ I"require 'set' ;TI">s1 = Set[1, 2] #=> #<Set: {1, 2}> ;TI">s2 = [1, 2].to_set #=> #<Set: {1, 2}> ;TI"4s1 == s2 #=> true ;TI"Es1.add("foo") #=> #<Set: {1, 2, "foo"}> ;TI"Hs1.merge([2, 6]) #=> #<Set: {1, 2, "foo", 6}> ;TI"5s1.subset?(s2) #=> false ;TI"4s2.subset?(s1) #=> true ;T:@format0S;;i;I"Contact;T@o;;[I"<- Akinori MUSHA <knu@iDaemons.org> (current maintainer);T;0; I"lib/set.rb;T; 0; 0; 0[ [ [[I"Enumerable;To;;[ ; @N; 0I"lib/set.rb;T[[I" class;T[[:public[ [:protected[ [:private[[I"[];T@V[I"json_create;TI"!ext/json/lib/json/add/set.rb;T[I"new;T@V[I" instance;T[[;[ [;[ [;[>[I"&;T@V[I"+;T@V[I"-;T@V[I"<;T@V[I"<<;T@V[I"<=;T@V[I"==;T@V[I"===;T@V[I">;T@V[I">=;T@V[I"^;T@V[I"add;T@V[I" add?;T@V[I"as_json;T@e[I" classify;T@V[I" clear;T@V[I" collect!;T@V[I"compare_by_identity;T@V[I"compare_by_identity?;T@V[I"delete;T@V[I"delete?;T@V[I"delete_if;T@V[I"difference;T@V[I"disjoint?;T@V[I"divide;T@V[I" each;T@V[I"empty?;T@V[I"filter!;T@V[I"flatten;T@V[I" flatten!;T@V[I" include?;T@V[I"initialize_clone;T@V[I"initialize_dup;T@V[I"inspect;T@V[I"intersect?;T@V[I"intersection;T@V[I"keep_if;T@V[I"length;T@V[I" map!;T@V[I"member?;T@V[I" merge;T@V[I"proper_subset?;T@V[I"proper_superset?;T@V[I"reject!;T@V[I"replace;T@V[I" reset;T@V[I"select!;T@V[I" size;T@V[I"subset?;T@V[I" subtract;T@V[I"superset?;T@V[I" to_a;T@V[I"to_json;T@e[I" to_s;T@V[I"to_set;T@V[I" union;T@V[I"|;T@V[ [U:RDoc::Context::Section[i 0o;;[ ; 0; 0[I"!ext/json/lib/json/add/set.rb;TI"lib/set.rb;T@NcRDoc::TopLevel
💾 Save Changes
❌ Cancel