Class: Overcommit::CommandSplitter::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/overcommit/command_splitter.rb

Overview

Encapsulates the result of a split argument run.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#statusesArray<Integer> (readonly)

status codes for invocations

Returns:

  • (Array<Integer>)

    the current value of statuses



23
24
25
# File 'lib/overcommit/command_splitter.rb', line 23

def statuses
  @statuses
end

#stderrsArray<String> (readonly)

standard error outputs from invocations

Returns:

  • (Array<String>)

    the current value of stderrs



23
24
25
# File 'lib/overcommit/command_splitter.rb', line 23

def stderrs
  @stderrs
end

#stdoutsArray<String> (readonly)

standard outputs from invocations

Returns:

  • (Array<String>)

    the current value of stdouts



23
24
25
# File 'lib/overcommit/command_splitter.rb', line 23

def stdouts
  @stdouts
end

Instance Method Details

#statustrue, false

Returns ‘0` if all invocations returned `0`; `1` otherwise.

Returns:

  • (true, false)


34
35
36
# File 'lib/overcommit/command_splitter.rb', line 34

def status
  statuses.all? { |code| code == 0 } ? 0 : 1
end

#stderrString

Returns concatenated standard error streams of all invocations in the order they were executed.

Returns:

  • (String)


50
51
52
# File 'lib/overcommit/command_splitter.rb', line 50

def stderr
  stderrs.join
end

#stdoutString

Returns concatenated standard output streams of all invocations in the order they were executed.

Returns:

  • (String)


42
43
44
# File 'lib/overcommit/command_splitter.rb', line 42

def stdout
  stdouts.join
end

#success?true, false

Returns whether all invocations were successful.

Returns:

  • (true, false)


27
28
29
# File 'lib/overcommit/command_splitter.rb', line 27

def success?
  status == 0
end