class ClasslessMud::Commands::BadCommand

Public Class Methods

matches(message) click to toggle source
# File lib/classless_mud/commands/bad_command.rb, line 15
def self.matches message
  Suggestions.new(message.split(' ').first)
             .matches(ClasslessMud::Commands::Commands.commands)
end
perform(game, player, message) click to toggle source
# File lib/classless_mud/commands/bad_command.rb, line 4
      def self.perform game, player, message
        if matches(message).any?
          player.puts <<EOS
Did you mean:
  #{matches(message).join(' ')}
EOS
        else
          player.puts 'You typed that wrong. Try again.'
        end
      end