Class: Nucleon::Util::Shell::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/core/util/shell.rb

Overview


Execution result interface

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, status = nil) ⇒ Result

Returns a new instance of Result.



20
21
22
23
24
25
# File 'lib/core/util/shell.rb', line 20

def initialize(command, status = nil)
  @command = command
  @output  = ''
  @errors  = ''
  @status  = status.nil? ? Nucleon.code.success : status
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



18
19
20
# File 'lib/core/util/shell.rb', line 18

def command
  @command
end

#statusObject

Returns the value of attribute status.



17
18
19
# File 'lib/core/util/shell.rb', line 17

def status
  @status
end

Instance Method Details

#append_errors(error_str) ⇒ Object



43
44
45
# File 'lib/core/util/shell.rb', line 43

def append_errors(error_str)
  @errors << error_str.rstrip << "\n"
end

#append_output(output_str) ⇒ Object




39
40
41
# File 'lib/core/util/shell.rb', line 39

def append_output(output_str)
  @output << output_str.rstrip << "\n"
end

#errorsObject



33
34
35
# File 'lib/core/util/shell.rb', line 33

def errors
  @errors.strip
end

#outputObject




29
30
31
# File 'lib/core/util/shell.rb', line 29

def output
  @output.strip
end