Class: CommandManager

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ CommandManager

Returns a new instance of CommandManager.



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

def initialize(path)
  @commands = YAML.load_file(path) if File.exist?(path)
end

Instance Attribute Details

#commandsObject

Returns the value of attribute commands.



4
5
6
# File 'lib/command_manager.rb', line 4

def commands
  @commands
end

Instance Method Details

#execute(hypotheses) ⇒ Object



10
11
12
13
14
# File 'lib/command_manager.rb', line 10

def execute(hypotheses)
  command = find(hypotheses)
  system("#{command} &")
  return command
end