Class: Dply::Command
- Inherits:
-
Object
- Object
- Dply::Command
- Defined in:
- lib/dply/command.rb
Instance Method Summary collapse
- #capture ⇒ Object
-
#initialize(command, env: {}, shell: false) ⇒ Command
constructor
A new instance of Command.
- #run ⇒ Object
Constructor Details
#initialize(command, env: {}, shell: false) ⇒ Command
Returns a new instance of Command.
7 8 9 10 11 12 |
# File 'lib/dply/command.rb', line 7 def initialize(command, env: {}, shell: false) @command = command @env = env @shell = shell validate! end |
Instance Method Details
#capture ⇒ Object
18 19 20 |
# File 'lib/dply/command.rb', line 18 def capture assert_success { IO.popen(@env, command, unsetenv_others: true) { |f| f.read } } end |
#run ⇒ Object
14 15 16 |
# File 'lib/dply/command.rb', line 14 def run assert_success { system(@env, *command, unsetenv_others: true, 2 => 1) } end |