Class: ActiveStatus::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/active_status/report.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeReport

Returns a new instance of Report.



5
6
7
# File 'lib/active_status/report.rb', line 5

def initialize
  @errors = []
end

Instance Attribute Details

#errorsObject (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

#buildObject



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.message))
    end
  end
end

#success?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/active_status/report.rb', line 21

def success?
  @errors.empty?
end