Class: Wordlist::Operators::Union
- Inherits:
-
BinaryOperator
- Object
- Operator
- BinaryOperator
- Wordlist::Operators::Union
- Defined in:
- lib/wordlist/operators/union.rb
Overview
Lazily enumerates over words from both wordlists, filtering out any duplicates.
Instance Attribute Summary
Attributes inherited from BinaryOperator
Instance Method Summary collapse
-
#each {|word| ... } ⇒ Enumerator
Enumerates over the union of the two wordlists.
Methods inherited from BinaryOperator
Constructor Details
This class inherits a constructor from Wordlist::Operators::BinaryOperator
Instance Method Details
#each {|word| ... } ⇒ Enumerator
Enumerates over the union of the two wordlists.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/wordlist/operators/union.rb', line 43 def each return enum_for(__method__) unless block_given? unique_filter = UniqueFilter.new @left.each do |word| yield word unique_filter.add(word) end @right.each do |word| unless unique_filter.include?(word) yield word end end end |