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



21
22
23
# File 'lib/overcommit/command_splitter.rb', line 21

def statuses
  @statuses
end

#stderrsArray<String> (readonly)

standard error outputs from invocations

Returns:

  • (Array<String>)

    the current value of stderrs



21
22
23
# File 'lib/overcommit/command_splitter.rb', line 21

def stderrs
  @stderrs
end

#stdoutsArray<String> (readonly)

standard outputs from invocations

Returns:

  • (Array<String>)

    the current value of stdouts



21
22
23
# File 'lib/overcommit/command_splitter.rb', line 21

def stdouts
  @stdouts
end

Instance Method Details

#statustrue, false

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

Returns:

  • (true, false)


32
33
34
# File 'lib/overcommit/command_splitter.rb', line 32

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)


48
49
50
# File 'lib/overcommit/command_splitter.rb', line 48

def stderr
  stderrs.join
end

#stdoutString

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

Returns:

  • (String)


40
41
42
# File 'lib/overcommit/command_splitter.rb', line 40

def stdout
  stdouts.join
end

#success?true, false

Returns whether all invocations were successful.

Returns:

  • (true, false)


25
26
27
# File 'lib/overcommit/command_splitter.rb', line 25

def success?
  status == 0
end