class Wordlist::Words
An in-memory wordlist of words.
Wordlist::Words["foo", "bar", "baz"]
@api public
@since 1.0.0
Attributes
words[R]
The words in the wordlist.
@return [Array<String>, Enumerable]
Public Class Methods
[](*words)
click to toggle source
Creates a new wordlist from the given words.
@param [Array<String>] words
The words for the wordlist.
@example
Wordlist::Words["foo", "bar", "baz"]
@api public
# File lib/wordlist/words.rb, line 44 def self.[](*words) new(words) end
new(words=[])
click to toggle source
Creates a new wordlist object.
@param [Array<String>, Enumerable] words
The words for the wordlist.
@api public
# File lib/wordlist/words.rb, line 29 def initialize(words=[]) @words = words end
Public Instance Methods
each(&block)
click to toggle source
Enumerate through every word in the in-memory wordlist.
@yield [word]
The given block will be passed each word in the list.
@yieldparam [String] word
A word from the in-memory wordlist.
@return [Enumerator]
If no block is given, then an `Enumerator` object will be returned.
@example
words.each do |word| puts word end
@api public
# File lib/wordlist/words.rb, line 67 def each(&block) @words.each(&block) end