class Expeditor::Status

Thread unsafe.

Attributes

break[R]
dependency[R]
failure[R]
rejection[R]
success[R]
timeout[R]

Public Class Methods

new() click to toggle source
# File lib/expeditor/status.rb, line 11
def initialize
  set(0, 0, 0, 0, 0, 0)
end

Public Instance Methods

increment(type, i = 1) click to toggle source
# File lib/expeditor/status.rb, line 15
def increment(type, i = 1)
  case type
  when :success
    @success += i
  when :failure
    @failure += i
  when :rejection
    @rejection += i
  when :timeout
    @timeout += i
  when :break
    @break += i
  when :dependency
    @dependency += i
  else
    raise ArgumentError.new("Unknown type: #{type}")
  end
end
merge!(other) click to toggle source
# File lib/expeditor/status.rb, line 34
def merge!(other)
  increment(:success, other.success)
  increment(:failure, other.failure)
  increment(:rejection, other.rejection)
  increment(:timeout, other.timeout)
  increment(:break, other.break)
  increment(:dependency, other.dependency)
  self
end
reset() click to toggle source
# File lib/expeditor/status.rb, line 44
def reset
  set(0, 0, 0, 0, 0, 0)
end

Private Instance Methods

set(s, f, r, t, b, d) click to toggle source
# File lib/expeditor/status.rb, line 50
def set(s, f, r, t, b, d)
  @success = s
  @failure = f
  @rejection = r
  @timeout = t
  @break = b
  @dependency = d
end