Class: TouchscreenTaps::Executor

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

Overview

Executes commands from config file

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Executor

Returns a new instance of Executor.



6
7
8
# File 'lib/touchscreen_taps/executor.rb', line 6

def initialize(config)
  @config = config
end

Instance Method Details

#run(cmd) ⇒ Object



10
11
12
13
14
15
# File 'lib/touchscreen_taps/executor.rb', line 10

def run(cmd)
  return if cmd.nil?

  command = @config.by_keys(command_to_keys(cmd)).fetch('command')
  execute(command) if command
end