Class: Wellness::System
- Inherits:
-
Object
- Object
- Wellness::System
- Defined in:
- lib/wellness/system.rb
Overview
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #build_report ⇒ Object
- #detailed_check ⇒ Object
- #details ⇒ Object
-
#initialize(name) ⇒ System
constructor
A new instance of System.
- #services ⇒ Object
- #simple_check ⇒ Object
- #use(klass, *args) ⇒ Object
Constructor Details
#initialize(name) ⇒ System
Returns a new instance of System.
10 11 12 13 14 15 |
# File 'lib/wellness/system.rb', line 10 def initialize(name) @name = name @services = [] @details = [] @mutex = Mutex.new end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/wellness/system.rb', line 7 def name @name end |
Instance Method Details
#build_report ⇒ Object
38 39 40 41 42 |
# File 'lib/wellness/system.rb', line 38 def build_report @mutex.synchronize do Wellness::Report.new(services.map(&:call), details.map(&:call)) end end |
#detailed_check ⇒ Object
28 29 30 31 |
# File 'lib/wellness/system.rb', line 28 def detailed_check report = build_report [report.status_code, { 'Content-Type' => 'application/json' }, [report.detailed.to_json]] end |
#details ⇒ Object
48 49 50 |
# File 'lib/wellness/system.rb', line 48 def details @details.map(&:build) end |
#services ⇒ Object
44 45 46 |
# File 'lib/wellness/system.rb', line 44 def services @services.map(&:build) end |
#simple_check ⇒ Object
33 34 35 36 |
# File 'lib/wellness/system.rb', line 33 def simple_check report = build_report [report.status_code, { 'Content-Type' => 'application/json' }, [report.simple.to_json]] end |