Method: Wordlist::ListMethods#subtract

Defined in:
lib/wordlist/list_methods.rb

#subtract(other) ⇒ Operators::Subtract Also known as: -

Lazily enumerates over every word in the first wordlist, that is not in the second wordlist.

Examples:

wordlist1 = Wordlist::Words["foo", "bar", baz", "qux"]
wordlist2 = Wordlist::Words["bar", "qux"]
(wordlist1 - wordlist2).each do |word|
  puts word
end
# foo
# baz

Parameters:

  • other (Enumerable)

    The other wordlist to subtract.

Returns:

Since:

  • 1.0.0



66
67
68
# File 'lib/wordlist/list_methods.rb', line 66

def subtract(other)
  Operators::Subtract.new(self,other)
end