Class: Gemwarrior::WordList

Inherits:
Object
  • Object
show all
Defined in:
lib/gemwarrior/misc/wordlist.rb

Constant Summary collapse

STATIC_ADJECTIVE_VALUES =
[
  '5 o\'clock-shadowed', 'angry', 'aristocratic', 'calm', 'choice', 'clinical', 'cracked', 'depressed', 'dingy', 'excited', 'ginormous', 'handsome', 'hydrothermal', 'lackadaisical', 'man-sized', 'moist', 'non-venomous', 'picaresque', 'positive', 'relaxed', 'ruddy', 'smooth', 'shocked', 'sticky', 'tense', 'tingly', 'tired', 'toneless', 'unpolished', 'worn'
]
STATIC_NOUN_VALUES =
[
  'arrestor', 'blockhead', 'busker', 'candlestick', 'cigarette', 'clavinet', 'cursor', 'degeneration', 'devotchka', 'drive', 'earthquake', 'genie', 'granddaddy', 'haunter', 'heater', 'locality', 'nitrogen', 'quitter', 'raccoon', 'radish', 'recession', 'sheepdog', 'smorgasbord', 'softener', 'sphere', 'stage-hand', 'tsunami', 'tuber', 'whatsit', 'zillionaire'
]
STATIC_NOUN_PLURAL_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'
]
STATIC_VERB_VALUES =
[
  'accentuate', 'accompany', 'blatter', 'bully', 'collide', 'crusade', 'disallow', 'entitle', 'infest', 'lateral', 'micturate', 'mourn', 'munge', 'numb', 'outdraw', 'overstep', 'plummet', 'refill', 'refurnish', 'reroute', 'rumple', 'scupper', 'smoosh', 'spifflicate', 'straighten', 'synthesize', 'terrorize', 'unshift', 'vociferate'
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type = 'noun', limit = 10) ⇒ WordList

Returns a new instance of WordList.



26
27
28
29
30
31
# File 'lib/gemwarrior/misc/wordlist.rb', line 26

def initialize(type = 'noun', limit = 10)
  self.type         = type
  self.limit        = limit
  self.words        = populate_words(type, limit)
  self.error        = nil
end

Instance Attribute Details

#errorObject

Returns the value of attribute error.



24
25
26
# File 'lib/gemwarrior/misc/wordlist.rb', line 24

def error
  @error
end

#limitObject

Returns the value of attribute limit.



24
25
26
# File 'lib/gemwarrior/misc/wordlist.rb', line 24

def limit
  @limit
end

#typeObject

Returns the value of attribute type.



24
25
26
# File 'lib/gemwarrior/misc/wordlist.rb', line 24

def type
  @type
end

#wordsObject

Returns the value of attribute words.



24
25
26
# File 'lib/gemwarrior/misc/wordlist.rb', line 24

def words
  @words
end

Instance Method Details

#get_random_valueObject



33
34
35
36
37
# File 'lib/gemwarrior/misc/wordlist.rb', line 33

def get_random_value
  random_value = words[rand(0..limit)]

  return random_value.nil? ? get_random_value : random_value
end

#list_wordsObject



39
40
41
# File 'lib/gemwarrior/misc/wordlist.rb', line 39

def list_words
  words.join(',')
end