Class: CommandSuggestion
- Inherits:
-
Object
- Object
- CommandSuggestion
- Defined in:
- lib/command/command_suggestion.rb
Constant Summary collapse
- SHORT_ENOUGH =
3
Instance Attribute Summary collapse
-
#wordlist ⇒ Object
Returns the value of attribute wordlist.
Instance Method Summary collapse
- #abbreviation ⇒ Object
-
#initialize(wordlist) ⇒ CommandSuggestion
constructor
A new instance of CommandSuggestion.
- #to_s ⇒ Object
Constructor Details
#initialize(wordlist) ⇒ CommandSuggestion
6 7 8 |
# File 'lib/command/command_suggestion.rb', line 6 def initialize(wordlist) @wordlist = wordlist end |
Instance Attribute Details
#wordlist ⇒ Object
Returns the value of attribute wordlist.
2 3 4 |
# File 'lib/command/command_suggestion.rb', line 2 def wordlist @wordlist end |
Instance Method Details
#abbreviation ⇒ Object
18 19 20 |
# File 'lib/command/command_suggestion.rb', line 18 def abbreviation wordlist.map{|w| CommandWord.suggested_letter(w) }.join.downcase end |
#to_s ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/command/command_suggestion.rb', line 10 def to_s if exists? "'#{command}' => #{abbreviation} taken :(" else "'#{command}' => " + "#{abbreviation}".green end end |