module Command
  module Matcher
    def self.parse(string)
      all.each do |matcher|
        command = matcher.build_with_match(string)
        return command if command
      end
      nil
    end

    def self.all
      constants(false).reject! { |const| const == :Base }.map { |const| const_get(const) }
    end
  end
end

require './lib/toy_robot_simulator/command/matcher/base'
require './lib/toy_robot_simulator/command/matcher/place'

module Command
  module Matcher
    def self.parse(string)
      all.each do |matcher|
        command = matcher.build_with_match(string)
        return command if command
      end
      nil
    end

    def self.all
      constants(false).reject! { |const| const == :Base }.map { |const| const_get(const) }
    end
  end
end

Fix bug in Command::Matcher (hidden dependancy)
Fix bug in Command::Matcher (hidden dependancy)

This Module is dependant on ::Base and ::Place since it calls
.constatns() on self, thus expects those constatnts to be defined.

Solution is to require those modules at top of file. Better design
is the way to solve this if more constants are to be defined in
the future.
