Class: Wordlist::Operators::Unique
- Inherits:
-
UnaryOperator
- Object
- Operator
- UnaryOperator
- Wordlist::Operators::Unique
- Defined in:
- lib/wordlist/operators/unique.rb
Overview
Lazily enumerates over only the unique words in the wordlist, filtering out duplicates.
Instance Attribute Summary
Attributes inherited from UnaryOperator
Instance Method Summary collapse
-
#each {|word| ... } ⇒ Enumerator
Enumerates over the unique words in the wordlist.
Methods inherited from UnaryOperator
Constructor Details
This class inherits a constructor from Wordlist::Operators::UnaryOperator
Instance Method Details
#each {|word| ... } ⇒ Enumerator
Enumerates over the unique words in the wordlist.
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/wordlist/operators/unique.rb', line 39 def each return enum_for(__method__) unless block_given? unique_filter = UniqueFilter.new @wordlist.each do |word| if unique_filter.add?(word) yield word end end end |