Sha256: 5f1f7a21e9db5713ac458f4edbf8a8b4db70cb173a2c43368c00cc4da7d9fc0b
Contents?: true
Size: 474 Bytes
Versions: 57
Compression:
Stored size: 474 Bytes
Contents
class Stats include ActiveModel::Model attr_accessor :passed, :passed_with_warnings, :failed, :pending def submitted passed + passed_with_warnings + failed end def done? failed + pending == 0 end def started? submitted > 0 end def self.from_statuses(statuses) Stats.new(statuses.inject({passed: 0, passed_with_warnings: 0, failed: 0, pending: 0}) do |accum, status| accum[status.group.to_sym] += 1 accum end) end end
Version data entries
57 entries across 57 versions & 2 rubygems