Method: Wordlist::Operators::Power#each

Defined in:
lib/wordlist/operators/power.rb

#each {|string| ... } ⇒ Enumerator

Enumerates over every combination of words from the wordlist.

Examples:

wordlist = Wordlist::Words["foo", "bar"]
(wordlist ** 3).each do |word|
  puts word
end
# foofoofoo
# foofoobar
# foobarfoo
# foobarbar
# barfoofoo
# barfoobar
# barbarfoo
# barbarbar

Yields:

  • (string)

    The given block will be passed each combination of words from the wordlist.

Yield Parameters:

  • string (String)

    A combination of words from the wordlist.

Returns:

  • (Enumerator)

    If no block is given, an Enumerator object will be returned.

Since:

  • 1.0.0



67
68
69
# File 'lib/wordlist/operators/power.rb', line 67

def each(&block)
  @wordlists.each(&block)
end