Class: Sbire::CommandManager
- Inherits:
-
Object
- Object
- Sbire::CommandManager
- Defined in:
- lib/sbire/command_manager.rb
Instance Attribute Summary collapse
-
#commands ⇒ Object
Returns the value of attribute commands.
Instance Method Summary collapse
- #execute(hypotheses, index) ⇒ Object
-
#initialize(path) ⇒ CommandManager
constructor
A new instance of CommandManager.
Constructor Details
#initialize(path) ⇒ CommandManager
Returns a new instance of CommandManager.
5 6 7 |
# File 'lib/sbire/command_manager.rb', line 5 def initialize(path) @commands = YAML.load_file(path) if File.exist?(path) end |
Instance Attribute Details
#commands ⇒ Object
Returns the value of attribute commands.
3 4 5 |
# File 'lib/sbire/command_manager.rb', line 3 def commands @commands end |
Instance Method Details
#execute(hypotheses, index) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/sbire/command_manager.rb', line 9 def execute(hypotheses, index) current_hypothese = hypotheses[index] unless current_hypothese.first.empty? command = find(current_hypothese) system("#{command} &") return command end end |