Class: Jank::Command

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

Instance Method Summary collapse

Constructor Details

#initialize(args, config, janker, executor) ⇒ Command

Returns a new instance of Command.



3
4
5
6
7
8
# File 'lib/command.rb', line 3

def initialize(args, config, janker, executor)
  @config = config
  @janker = janker
  @exec = executor
  @args = args
end

Instance Method Details

#dispatchObject



10
11
12
13
14
15
16
17
# File 'lib/command.rb', line 10

def dispatch
  command = "#{@args[0]}_command"
  if !self.respond_to? command
    command = 'help'
  end

  self.send(command)
end