Sha256: 6081d199d71b02ff8a7b4e0b3ea8ec433dcf19b0391a9dd6225c85dc315ca057

Contents?: true

Size: 696 Bytes

Versions: 13

Compression:

Stored size: 696 Bytes

Contents

module Shipit
  class StatusGroup
    STATES_PRIORITY = %w(failure error pending success).freeze

    attr_reader :statuses, :significant_status

    def initialize(significant_status, visible_statuses)
      @significant_status = significant_status
      @statuses = visible_statuses
    end

    delegate :pending?, :success?, :error?, :failure?, :state, to: :significant_status

    def description
      "#{success_count} / #{statuses.count} checks OK"
    end

    def target_url
    end

    def to_partial_path
      'statuses/group'
    end

    def group?
      true
    end

    private

    def success_count
      @statuses.count { |s| s.state == 'success'.freeze }
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
shipit-engine-0.11.0 app/models/shipit/status_group.rb
shipit-engine-0.10.0 app/models/shipit/status_group.rb
shipit-engine-0.9.0 app/models/shipit/status_group.rb
shipit-engine-0.8.9 app/models/shipit/status_group.rb
shipit-engine-0.8.8 app/models/shipit/status_group.rb
shipit-engine-0.8.7 app/models/shipit/status_group.rb
shipit-engine-0.8.6 app/models/shipit/status_group.rb
shipit-engine-0.8.5 app/models/shipit/status_group.rb
shipit-engine-0.8.4 app/models/shipit/status_group.rb
shipit-engine-0.8.3 app/models/shipit/status_group.rb
shipit-engine-0.8.2 app/models/shipit/status_group.rb
shipit-engine-0.8.1 app/models/shipit/status_group.rb
shipit-engine-0.8.0 app/models/shipit/status_group.rb