Class: Disloku::SysCmd
- Inherits:
-
Object
- Object
- Disloku::SysCmd
- Defined in:
- lib/disloku/SysCmd.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(cmd, *args) ⇒ SysCmd
constructor
A new instance of SysCmd.
Constructor Details
#initialize(cmd, *args) ⇒ SysCmd
Returns a new instance of SysCmd.
6 7 8 9 10 11 |
# File 'lib/disloku/SysCmd.rb', line 6 def initialize(cmd, *args) @cmd = cmd if (!args.empty?) @cmd = @cmd.gsub(/\$(\d+)/) { |m| args[m[1].to_i() - 1] } end end |
Instance Method Details
#execute ⇒ Object
13 14 15 16 |
# File 'lib/disloku/SysCmd.rb', line 13 def execute() Log.instance.debug("executing '#{@cmd}'") return SysCmdResult.new(%x(#{@cmd}), $?) end |