app/models/commit_status.rb
# merges multiple statuses into a single status
# @return [Hash]
merges multiple statuses into a single status
merges multiple statuses into a single status
def merge_statuses(statuses)
    statuses[1..].each_with_object(statuses[0].dup) do |status, merged|
      merged[:state] = [merged.fetch(:state), status.fetch(:state)].max_by { |s| STATE_PRIORITY.index(s.to_sym) }
      merged.fetch(:statuses).concat(status.fetch(:statuses))
    end
  end
def merge_statuses ( statuses ) statuses [ 1 .. ] . each_with_object ( statuses [ 0 ] . dup ) do | status , merged | merged [ :state ] = [ merged . fetch ( :state ) , status . fetch ( :state ) ] . max_by { | s | STATE_PRIORITY . index ( s . to_sym ) } merged . fetch ( :statuses ) . concat ( status . fetch ( :statuses ) ) end end
merges multiple statuses into a single status
merges multiple statuses into a single status
None
Hash
statuses