Class: Atoyrobot::CommandFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/atoyrobot/command_factory.rb

Constant Summary collapse

COMMANDS =
Atoyrobot::Commands::Base.descendants_names.map(&:upcase)

Class Method Summary collapse

Class Method Details

.init(command, args = []) ⇒ Object



16
17
18
19
20
# File 'lib/atoyrobot/command_factory.rb', line 16

def init(command, args = [])
  valid_command(command).new(*args)
rescue ArgumentError
  invalid_command("invalid arguments for #{command}")
end