Class: Stats
Instance Attribute Summary collapse
-
#failed ⇒ Object
Returns the value of attribute failed.
-
#passed ⇒ Object
Returns the value of attribute passed.
-
#passed_with_warnings ⇒ Object
Returns the value of attribute passed_with_warnings.
-
#pending ⇒ Object
Returns the value of attribute pending.
-
#skipped ⇒ Object
Returns the value of attribute skipped.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#failed ⇒ Object
Returns the value of attribute failed.
4 5 6 |
# File 'app/models/stats.rb', line 4 def failed @failed end |
#passed ⇒ Object
Returns the value of attribute passed.
4 5 6 |
# File 'app/models/stats.rb', line 4 def passed @passed end |
#passed_with_warnings ⇒ Object
Returns the value of attribute passed_with_warnings.
4 5 6 |
# File 'app/models/stats.rb', line 4 def passed_with_warnings @passed_with_warnings end |
#pending ⇒ Object
Returns the value of attribute pending.
4 5 6 |
# File 'app/models/stats.rb', line 4 def pending @pending end |
#skipped ⇒ Object
Returns the value of attribute skipped.
4 5 6 |
# File 'app/models/stats.rb', line 4 def skipped @skipped end |
Class Method Details
.from_statuses(statuses) ⇒ Object
22 23 24 25 26 27 |
# File 'app/models/stats.rb', line 22 def self.from_statuses(statuses) Stats.new(statuses.inject({passed: 0, passed_with_warnings: 0, failed: 0, pending: 0, skipped: 0}) do |accum, status| accum[status.group.to_sym] += 1 accum end) end |
Instance Method Details
#almost_done? ⇒ Boolean
14 15 16 |
# File 'app/models/stats.rb', line 14 def almost_done? failed + pending <= 1 end |
#done? ⇒ Boolean
10 11 12 |
# File 'app/models/stats.rb', line 10 def done? failed + pending == 0 end |
#started? ⇒ Boolean
18 19 20 |
# File 'app/models/stats.rb', line 18 def started? submitted > 0 end |
#submitted ⇒ Object
6 7 8 |
# File 'app/models/stats.rb', line 6 def submitted passed + passed_with_warnings + failed end |