Class: Mercy::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/mercy/status.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reports) ⇒ Status

Returns a new instance of Status.



5
6
7
# File 'lib/mercy/status.rb', line 5

def initialize(reports)
  @reports = reports
end

Instance Attribute Details

#reportsObject (readonly)

Returns the value of attribute reports.



3
4
5
# File 'lib/mercy/status.rb', line 3

def reports
  @reports
end

Instance Method Details

#as_jsonObject



13
14
15
16
17
# File 'lib/mercy/status.rb', line 13

def as_json
  {
    status: status
  }.merge(reports_jsons)
end

#statusObject



9
10
11
# File 'lib/mercy/status.rb', line 9

def status
  reports.any? { |r| r.error? } ? :error : :ok
end