Class: ClasslessMud::Commands::BadCommand
- Inherits:
-
Object
- Object
- ClasslessMud::Commands::BadCommand
- Defined in:
- lib/classless_mud/commands/bad_command.rb
Defined Under Namespace
Classes: Suggestions
Class Method Summary collapse
Class Method Details
.matches(message) ⇒ Object
15 16 17 18 |
# File 'lib/classless_mud/commands/bad_command.rb', line 15 def self.matches Suggestions.new(.split(' ').first) .matches(ClasslessMud::Commands::Commands.commands) end |
.perform(game, player, message) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/classless_mud/commands/bad_command.rb', line 4 def self.perform game, player, if matches().any? player.puts "Did you mean:\n \#{matches(message).join(' ')}\n" else player.puts 'You typed that wrong. Try again.' end end |