Class: Scallop::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/scallop/result.rb

Overview

Represents a result of command execution.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stdout:, stderr:, status:, timing:) ⇒ Result


12
13
14
15
16
17
18
# File 'lib/scallop/result.rb', line 12

def initialize(stdout:, stderr:, status:, timing:)
  @stdout = stdout
  @stderr = stderr
  @status = status
  @timing = timing
  @output = [stdout, stderr].reject { |s| s.nil? || s.empty? }.join("\n")
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output


10
11
12
# File 'lib/scallop/result.rb', line 10

def output
  @output
end

#statusObject (readonly)

Returns the value of attribute status


8
9
10
# File 'lib/scallop/result.rb', line 8

def status
  @status
end

#stderrObject (readonly)

Returns the value of attribute stderr


7
8
9
# File 'lib/scallop/result.rb', line 7

def stderr
  @stderr
end

#stdoutObject (readonly)

Returns the value of attribute stdout


6
7
8
# File 'lib/scallop/result.rb', line 6

def stdout
  @stdout
end

#timingObject (readonly)

Returns the value of attribute timing


9
10
11
# File 'lib/scallop/result.rb', line 9

def timing
  @timing
end

Instance Method Details

#success?Boolean


20
21
22
# File 'lib/scallop/result.rb', line 20

def success?
  @status.success?
end