Class: Wordlist::Operators::Subtract
- Inherits:
-
BinaryOperator
- Object
- Operator
- BinaryOperator
- Wordlist::Operators::Subtract
- Defined in:
- lib/wordlist/operators/subtract.rb
Overview
Lazily enumerates over every word in the first wordlist, that is not in the second wordlist.
Instance Attribute Summary
Attributes inherited from BinaryOperator
Instance Method Summary collapse
-
#each {|word| ... } ⇒ Enumerator
Enumerates over the difference between 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 difference between the two wordlists.
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/wordlist/operators/subtract.rb', line 39 def each return enum_for(__method__) unless block_given? unique_filter = UniqueFilter.new @right.each { |word| unique_filter.add(word) } @left.each do |word| unless unique_filter.include?(word) yield word end end end |