Class: Aric::ScriptRunner
- Inherits:
-
Object
- Object
- Aric::ScriptRunner
- Defined in:
- lib/aric/script_runner.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(file_name) ⇒ ScriptRunner
constructor
A new instance of ScriptRunner.
- #run(args = []) ⇒ Object
Constructor Details
#initialize(file_name) ⇒ ScriptRunner
Returns a new instance of ScriptRunner.
12 13 14 |
# File 'lib/aric/script_runner.rb', line 12 def initialize(file_name) @file_name = file_name.to_s end |
Class Method Details
.run(file_name, args = []) ⇒ Object
7 8 9 |
# File 'lib/aric/script_runner.rb', line 7 def run(file_name, args = []) new(file_name).run(args) end |
Instance Method Details
#run(args = []) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/aric/script_runner.rb', line 16 def run(args = []) @args = Array(args).join(' ') stdout, stderr, status = Open3.capture3(cmd) raise Aric::Error::ScriptExecutionError.new(stderr, cmd) unless status.success? stdout.strip end |