Class: Gemwarrior::WordList
- Inherits:
-
Object
- Object
- Gemwarrior::WordList
- Defined in:
- lib/gemwarrior/misc/wordlist.rb
Constant Summary collapse
- STATIC_NOUN_VALUES =
["abutments", "asterisms", "bains", "blebs", "blowholes", "chapes", "civility", "crocuses", "dancers", "deniers", "diastoles", "dinges", "dualism", "ebullitions", "extremities", "fingering", "gabardines", "gullets", "knops", "nooks", "payments", "phaetons", "scalawags", "snickers", "specters", "splats", "squiggles", "thalamuses", "wallets", "xylophones"]
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
-
#limit ⇒ Object
Returns the value of attribute limit.
-
#type ⇒ Object
Returns the value of attribute type.
-
#words ⇒ Object
Returns the value of attribute words.
Instance Method Summary collapse
- #get_random_value ⇒ Object
-
#initialize(type, limit = 10) ⇒ WordList
constructor
A new instance of WordList.
- #list_words ⇒ Object
Constructor Details
#initialize(type, limit = 10) ⇒ WordList
Returns a new instance of WordList.
13 14 15 16 17 18 |
# File 'lib/gemwarrior/misc/wordlist.rb', line 13 def initialize(type, limit = 10) self.type = type self.limit = limit self.words = populate_words(type, limit) self.error = nil end |
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
11 12 13 |
# File 'lib/gemwarrior/misc/wordlist.rb', line 11 def error @error end |
#limit ⇒ Object
Returns the value of attribute limit.
11 12 13 |
# File 'lib/gemwarrior/misc/wordlist.rb', line 11 def limit @limit end |
#type ⇒ Object
Returns the value of attribute type.
11 12 13 |
# File 'lib/gemwarrior/misc/wordlist.rb', line 11 def type @type end |
#words ⇒ Object
Returns the value of attribute words.
11 12 13 |
# File 'lib/gemwarrior/misc/wordlist.rb', line 11 def words @words end |
Instance Method Details
#get_random_value ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/gemwarrior/misc/wordlist.rb', line 20 def get_random_value random_value = words[rand(0..limit)] if random_value.nil? get_random_value else return random_value end end |
#list_words ⇒ Object
30 31 32 |
# File 'lib/gemwarrior/misc/wordlist.rb', line 30 def list_words words.join(',') end |