Class: Commandline::Return

Inherits:
Object
  • Object
show all
Defined in:
lib/utils/commandline/return.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stdout:, stderr:, exit_code:) ⇒ Return

Returns a new instance of Return.



5
6
7
8
9
# File 'lib/utils/commandline/return.rb', line 5

def initialize(stdout:, stderr:, exit_code:)
  @stdout = normalise(stdout)
  @stderr = normalise(stderr)
  @exit_code = exit_code
end

Instance Attribute Details

#exit_codeObject (readonly)

Returns the value of attribute exit_code.



3
4
5
# File 'lib/utils/commandline/return.rb', line 3

def exit_code
  @exit_code
end

#stderrObject (readonly)

Returns the value of attribute stderr.



3
4
5
# File 'lib/utils/commandline/return.rb', line 3

def stderr
  @stderr
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



3
4
5
# File 'lib/utils/commandline/return.rb', line 3

def stdout
  @stdout
end

Instance Method Details

#==(other) ⇒ Object



27
28
29
# File 'lib/utils/commandline/return.rb', line 27

def ==(other)
  other.to_s == to_s
end

#error?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/utils/commandline/return.rb', line 11

def error?
  exit_code != 0
end

#to_sObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/utils/commandline/return.rb', line 15

def to_s
  "    EXIT CODE: \#{exit_code}\n\n    STDOUT:\n    \#{stdout}\n\n    STDERR:\n    \#{stderr}\n  OUTPUT\nend\n"