Class: ActiveStatus::Report
- Inherits:
-
Object
- Object
- ActiveStatus::Report
- Defined in:
- lib/active_status/report.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
- #add_error(error) ⇒ Object
- #build ⇒ Object
-
#initialize ⇒ Report
constructor
A new instance of Report.
- #success? ⇒ Boolean
Constructor Details
#initialize ⇒ Report
Returns a new instance of Report.
5 6 7 |
# File 'lib/active_status/report.rb', line 5 def initialize @errors = [] end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
3 4 5 |
# File 'lib/active_status/report.rb', line 3 def errors @errors end |
Instance Method Details
#add_error(error) ⇒ Object
25 26 27 |
# File 'lib/active_status/report.rb', line 25 def add_error(error) @errors << error end |
#build ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/active_status/report.rb', line 9 def build ActiveStatus.config.checks.each do |check, method| begin success = method.call add_error(Error.new(check, 'failure')) unless success rescue StandardError => e add_error(Error.new(check, e.class.name, e.)) end end end |
#success? ⇒ Boolean
21 22 23 |
# File 'lib/active_status/report.rb', line 21 def success? @errors.empty? end |