Method: Weak::Set#|
- Defined in:
- lib/weak/set.rb
#|(enum) ⇒ Weak::Set Also known as: +, union
Note:
Weak::Set does not test member equality with ‘==` or `eql?`. Instead, it always checks strict object equality, so that, e.g., different strings are not considered equal, even if they may contain the same string content.
Returns a new weak set built by merging ‘self` and the elements of the given enumerable object.
261 262 263 264 265 266 267 |
# File 'lib/weak/set.rb', line 261 def |(enum) new_set = dup do_with_enum(enum) do |obj| new_set.add(obj) end new_set end |