|
88 | 88 | #
|
89 | 89 | # ### Methods for Creating a \Set
|
90 | 90 | #
|
91 |
| -# - ::[] - |
| 91 | +# - ::[]: |
92 | 92 | # Returns a new set containing the given objects.
|
93 |
| -# - ::new - |
| 93 | +# - ::new: |
94 | 94 | # Returns a new set containing either the given objects
|
95 | 95 | # (if no block given) or the return values from the called block
|
96 | 96 | # (if a block given).
|
97 | 97 | #
|
98 | 98 | # ### Methods for \Set Operations
|
99 | 99 | #
|
100 |
| -# - [|](#method-i-7C) (aliased as #union and #+) - |
| 100 | +# - [|](#method-i-7C) (aliased as #union and #+): |
101 | 101 | # Returns a new set containing all elements from +self+
|
102 | 102 | # and all elements from a given enumerable (no duplicates).
|
103 |
| -# - [&](#method-i-26) (aliased as #intersection) - |
| 103 | +# - [&](#method-i-26) (aliased as #intersection): |
104 | 104 | # Returns a new set containing all elements common to +self+
|
105 | 105 | # and a given enumerable.
|
106 |
| -# - [-](#method-i-2D) (aliased as #difference) - |
| 106 | +# - [-](#method-i-2D) (aliased as #difference): |
107 | 107 | # Returns a copy of +self+ with all elements
|
108 | 108 | # in a given enumerable removed.
|
109 |
| -# - [\^](#method-i-5E) - |
| 109 | +# - [\^](#method-i-5E): |
110 | 110 | # Returns a new set containing all elements from +self+
|
111 | 111 | # and a given enumerable except those common to both.
|
112 | 112 | #
|
113 | 113 | # ### Methods for Comparing
|
114 | 114 | #
|
115 |
| -# - [<=>](#method-i-3C-3D-3E) - |
| 115 | +# - [<=>](#method-i-3C-3D-3E): |
116 | 116 | # Returns -1, 0, or 1 as +self+ is less than, equal to,
|
117 | 117 | # or greater than a given object.
|
118 |
| -# - [==](#method-i-3D-3D) - |
| 118 | +# - [==](#method-i-3D-3D): |
119 | 119 | # Returns whether +self+ and a given enumerable are equal,
|
120 | 120 | # as determined by Object#eql?.
|
121 |
| -# - \#compare_by_identity? - |
| 121 | +# - \#compare_by_identity?: |
122 | 122 | # Returns whether the set considers only identity
|
123 | 123 | # when comparing elements.
|
124 | 124 | #
|
125 | 125 | # ### Methods for Querying
|
126 | 126 | #
|
127 |
| -# - \#length (aliased as #size) - |
| 127 | +# - \#length (aliased as #size): |
128 | 128 | # Returns the count of elements.
|
129 |
| -# - \#empty? - |
| 129 | +# - \#empty?: |
130 | 130 | # Returns whether the set has no elements.
|
131 |
| -# - \#include? (aliased as #member? and #===) - |
| 131 | +# - \#include? (aliased as #member? and #===): |
132 | 132 | # Returns whether a given object is an element in the set.
|
133 |
| -# - \#subset? (aliased as [<=](#method-i-3C-3D)) - |
| 133 | +# - \#subset? (aliased as [<=](#method-i-3C-3D)): |
134 | 134 | # Returns whether a given object is a subset of the set.
|
135 |
| -# - \#proper_subset? (aliased as [<](#method-i-3C)) - |
| 135 | +# - \#proper_subset? (aliased as [<](#method-i-3C)): |
136 | 136 | # Returns whether a given enumerable is a proper subset of the set.
|
137 |
| -# - \#superset? (aliased as [<=](#method-i-3E-3D])) - |
| 137 | +# - \#superset? (aliased as [<=](#method-i-3E-3D])): |
138 | 138 | # Returns whether a given enumerable is a superset of the set.
|
139 |
| -# - \#proper_superset? (aliased as [>](#method-i-3E)) - |
| 139 | +# - \#proper_superset? (aliased as [>](#method-i-3E)): |
140 | 140 | # Returns whether a given enumerable is a proper superset of the set.
|
141 |
| -# - \#disjoint? - |
| 141 | +# - \#disjoint?: |
142 | 142 | # Returns +true+ if the set and a given enumerable
|
143 | 143 | # have no common elements, +false+ otherwise.
|
144 |
| -# - \#intersect? - |
145 |
| -# Returns +true+ if the set and a given enumerable - |
| 144 | +# - \#intersect?: |
| 145 | +# Returns +true+ if the set and a given enumerable: |
146 | 146 | # have any common elements, +false+ otherwise.
|
147 |
| -# - \#compare_by_identity? - |
| 147 | +# - \#compare_by_identity?: |
148 | 148 | # Returns whether the set considers only identity
|
149 | 149 | # when comparing elements.
|
150 | 150 | #
|
151 | 151 | # ### Methods for Assigning
|
152 | 152 | #
|
153 |
| -# - \#add (aliased as #<<) - |
| 153 | +# - \#add (aliased as #<<): |
154 | 154 | # Adds a given object to the set; returns +self+.
|
155 |
| -# - \#add? - |
| 155 | +# - \#add?: |
156 | 156 | # If the given object is not an element in the set,
|
157 | 157 | # adds it and returns +self+; otherwise, returns +nil+.
|
158 |
| -# - \#merge - |
| 158 | +# - \#merge: |
159 | 159 | # Adds each given object to the set; returns +self+.
|
160 |
| -# - \#replace - |
| 160 | +# - \#replace: |
161 | 161 | # Replaces the contents of the set with the contents
|
162 | 162 | # of a given enumerable.
|
163 | 163 | #
|
164 | 164 | # ### Methods for Deleting
|
165 | 165 | #
|
166 |
| -# - \#clear - |
| 166 | +# - \#clear: |
167 | 167 | # Removes all elements in the set; returns +self+.
|
168 |
| -# - \#delete - |
| 168 | +# - \#delete: |
169 | 169 | # Removes a given object from the set; returns +self+.
|
170 |
| -# - \#delete? - |
| 170 | +# - \#delete?: |
171 | 171 | # If the given object is an element in the set,
|
172 | 172 | # removes it and returns +self+; otherwise, returns +nil+.
|
173 |
| -# - \#subtract - |
| 173 | +# - \#subtract: |
174 | 174 | # Removes each given object from the set; returns +self+.
|
175 | 175 | # - \#delete_if - Removes elements specified by a given block.
|
176 |
| -# - \#select! (aliased as #filter!) - |
| 176 | +# - \#select! (aliased as #filter!): |
177 | 177 | # Removes elements not specified by a given block.
|
178 |
| -# - \#keep_if - |
| 178 | +# - \#keep_if: |
179 | 179 | # Removes elements not specified by a given block.
|
180 | 180 | # - \#reject!
|
181 | 181 | # Removes elements specified by a given block.
|
182 | 182 | #
|
183 | 183 | # ### Methods for Converting
|
184 | 184 | #
|
185 |
| -# - \#classify - |
| 185 | +# - \#classify: |
186 | 186 | # Returns a hash that classifies the elements,
|
187 | 187 | # as determined by the given block.
|
188 |
| -# - \#collect! (aliased as #map!) - |
| 188 | +# - \#collect! (aliased as #map!): |
189 | 189 | # Replaces each element with a block return-value.
|
190 |
| -# - \#divide - |
| 190 | +# - \#divide: |
191 | 191 | # Returns a hash that classifies the elements,
|
192 | 192 | # as determined by the given block;
|
193 | 193 | # differs from #classify in that the block may accept
|
194 | 194 | # either one or two arguments.
|
195 |
| -# - \#flatten - |
| 195 | +# - \#flatten: |
196 | 196 | # Returns a new set that is a recursive flattening of +self+.
|
197 |
| -# \#flatten! - |
| 197 | +# \#flatten!: |
198 | 198 | # Replaces each nested set in +self+ with the elements from that set.
|
199 |
| -# - \#inspect (aliased as #to_s) - |
| 199 | +# - \#inspect (aliased as #to_s): |
200 | 200 | # Returns a string displaying the elements.
|
201 |
| -# - \#join - |
| 201 | +# - \#join: |
202 | 202 | # Returns a string containing all elements, converted to strings
|
203 | 203 | # as needed, and joined by the given record separator.
|
204 |
| -# - \#to_a - |
| 204 | +# - \#to_a: |
205 | 205 | # Returns an array containing all set elements.
|
206 |
| -# - \#to_set - |
| 206 | +# - \#to_set: |
207 | 207 | # Returns +self+ if given no arguments and no block;
|
208 | 208 | # with a block given, returns a new set consisting of block
|
209 | 209 | # return values.
|
210 | 210 | #
|
211 | 211 | # ### Methods for Iterating
|
212 | 212 | #
|
213 |
| -# - \#each - |
| 213 | +# - \#each: |
214 | 214 | # Calls the block with each successive element; returns +self+.
|
215 | 215 | #
|
216 | 216 | # ### Other Methods
|
217 | 217 | #
|
218 |
| -# - \#reset - |
| 218 | +# - \#reset: |
219 | 219 | # Resets the internal state; useful if an object
|
220 | 220 | # has been modified while an element in the set.
|
221 | 221 | #
|
|
0 commit comments