Class: Wordlist::Words
- Inherits:
-
AbstractWordlist
- Object
- AbstractWordlist
- Wordlist::Words
- Defined in:
- lib/wordlist/words.rb
Overview
An in-memory wordlist of words.
Wordlist::Words["foo", "bar", "baz"]
Instance Attribute Summary collapse
-
#words ⇒ Array<String>, Enumerable
readonly
The words in the wordlist.
Class Method Summary collapse
-
.[](*words) ⇒ Object
Creates a new wordlist from the given words.
Instance Method Summary collapse
-
#each {|word| ... } ⇒ Enumerator
Enumerate through every word in the in-memory wordlist.
-
#initialize(words = []) ⇒ Words
constructor
Creates a new wordlist object.
Methods included from ListMethods
#capitalize, #concat, #downcase, #gsub, #intersect, #mutate, #mutate_case, #power, #product, #sub, #subtract, #tr, #union, #uniq, #upcase
Constructor Details
#initialize(words = []) ⇒ Words
Creates a new wordlist object.
29 30 31 |
# File 'lib/wordlist/words.rb', line 29 def initialize(words=[]) @words = words end |
Instance Attribute Details
#words ⇒ Array<String>, Enumerable (readonly)
The words in the wordlist.
19 20 21 |
# File 'lib/wordlist/words.rb', line 19 def words @words end |
Class Method Details
.[](*words) ⇒ Object
Creates a new wordlist from the given words.
44 45 46 |
# File 'lib/wordlist/words.rb', line 44 def self.[](*words) new(words) end |
Instance Method Details
#each {|word| ... } ⇒ Enumerator
Enumerate through every word in the in-memory wordlist.
67 68 69 |
# File 'lib/wordlist/words.rb', line 67 def each(&block) @words.each(&block) end |