Class: CoinSync::RunCommandTask
- Inherits:
-
Object
- Object
- CoinSync::RunCommandTask
- Defined in:
- lib/coinsync/run_command_task.rb
Instance Method Summary collapse
-
#initialize(config) ⇒ RunCommandTask
constructor
A new instance of RunCommandTask.
- #run(source_name, command, args = []) ⇒ Object
Constructor Details
#initialize(config) ⇒ RunCommandTask
Returns a new instance of RunCommandTask.
5 6 7 |
# File 'lib/coinsync/run_command_task.rb', line 5 def initialize(config) @config = config end |
Instance Method Details
#run(source_name, command, args = []) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/coinsync/run_command_task.rb', line 9 def run(source_name, command, args = []) source = @config.sources[source_name] or raise "Source not found in the config file: '#{source_name}'" importer = source.importer if importer.class.registered_commands.include?(command.to_sym) importer.send(command.to_sym, *args) else raise "#{source_name}: no such command: #{command}" end end |