Class: Transfuse::Cmd
- Inherits:
-
Object
- Object
- Transfuse::Cmd
- Defined in:
- lib/transfuse/cmd.rb
Instance Attribute Summary collapse
-
#cmd ⇒ Object
Returns the value of attribute cmd.
-
#status ⇒ Object
Returns the value of attribute status.
-
#stderr ⇒ Object
Returns the value of attribute stderr.
-
#stdout ⇒ Object
Returns the value of attribute stdout.
Instance Method Summary collapse
-
#initialize(cmd) ⇒ Cmd
constructor
A new instance of Cmd.
- #run(file = nil) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(cmd) ⇒ Cmd
Returns a new instance of Cmd.
15 16 17 |
# File 'lib/transfuse/cmd.rb', line 15 def initialize cmd @cmd = cmd end |
Instance Attribute Details
#cmd ⇒ Object
Returns the value of attribute cmd.
13 14 15 |
# File 'lib/transfuse/cmd.rb', line 13 def cmd @cmd end |
#status ⇒ Object
Returns the value of attribute status.
13 14 15 |
# File 'lib/transfuse/cmd.rb', line 13 def status @status end |
#stderr ⇒ Object
Returns the value of attribute stderr.
13 14 15 |
# File 'lib/transfuse/cmd.rb', line 13 def stderr @stderr end |
#stdout ⇒ Object
Returns the value of attribute stdout.
13 14 15 |
# File 'lib/transfuse/cmd.rb', line 13 def stdout @stdout end |
Instance Method Details
#run(file = nil) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/transfuse/cmd.rb', line 19 def run file=nil unless file.nil? if File.exist?(file) and File.stat(file).size > 0 @stdout = "" @stderr = "" @status = Status.new return true end end @stdout, @stderr, @status = Open3.capture3 @cmd return false end |
#to_s ⇒ Object
32 33 34 |
# File 'lib/transfuse/cmd.rb', line 32 def to_s @cmd end |