Class: Intent::Dispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/intent/dispatcher.rb

Class Method Summary collapse

Class Method Details

.exec_command(command, args, output = STDOUT) ⇒ Object



3
4
5
6
# File 'lib/intent/dispatcher.rb', line 3

def self.exec_command(command, args, output=STDOUT)
  command = init_command(command).new
  command.run(args, output)
end

.init_command(command) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/intent/dispatcher.rb', line 8

def self.init_command(command)
  case command
  when :intent then return Commands::Intent
  when :inventory then return Commands::Inventory
  when :projects then return Commands::Projects
  when :project then return Commands::Project
  when :todo then return Commands::Todo
  else
    raise Commands::Errors::COMMAND_NOT_FOUND
  end
end