U:RDoc::NormalClass[iI"Set:ET@I" Object;To:RDoc::Markup::Document: @parts[o;;[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::BlankLineo; ;[ 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"AThe 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"6sets 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.new [1, 2] # -> # ;TI"?s2 = [1, 2].to_set # -> # ;TI"5s1 == s2 # -> true ;TI"Fs1.add("foo") # -> # ;TI"Is1.merge([2, 6]) # -> # ;TI"6s1.subset? s2 # -> false ;TI"5s2.subset? s1 # -> true ;T: @format0S;;i;I" Contact;T@o;;[I"<- Akinori MUSHA (current maintainer);T;0: @fileI"lib/set.rb;T:0@omit_headings_from_table_of_contents_below0;0;0[[[[I"Enumerable;To;;[;@K;0I"lib/set.rb;T[[I" class;T[[: public[[I"[];F@S[I"new;T@S[:protected[[: private[[I" instance;T[[;[8[I"&;T@S[I"+;T@S[I"-;T@S[I"<;T@S[I"<<;T@S[I"<=;T@S[I"==;T@S[I">;T@S[I">=;T@S[I"^;F@S[I"add;F@S[I" add?;F@S[I" classify;F@S[I" clear;F@S[I" collect!;F@S[I"compare_by_identity;F@S[I"compare_by_identity?;F@S[I" delete;F@S[I" delete?;F@S[I"delete_if;F@S[I"difference;F@S[I"disjoint?;F@S[I" divide;F@S[I" each;F@S[I" empty?;F@S[I" flatten;F@S[I" flatten!;F@S[I" include?;F@S[I"initialize_clone;F@S[I"initialize_dup;F@S[I" inspect;F@S[I"intersect?;F@S[I"intersection;F@S[I" keep_if;F@S[I" length;F@S[I" map!;F@S[I" member?;F@S[I" merge;F@S[I"proper_subset?;F@S[I"proper_superset?;F@S[I" reject!;F@S[I" replace;F@S[I" select!;F@S[I" size;F@S[I" subset?;F@S[I" subtract;F@S[I"superset?;F@S[I" to_a;F@S[I" to_set;F@S[I" union;F@S[I"|;T@S[;[[;[[[U:RDoc::Context::Section[i0o;;[;0;0[@K@KcRDoc::TopLevel