Class: Outpost::Report
- Inherits:
-
Object
- Object
- Outpost::Report
- Defined in:
- lib/outpost/report.rb
Overview
Contain the status report of an Outpost execution. Holds the name, description and status of the reported item.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
-
.summarize(status_list) ⇒ Symbol
Summarizes the list of statuses in a single status only.
Instance Method Summary collapse
-
#initialize(params) ⇒ Report
constructor
A new instance of Report.
- #to_s ⇒ Object
Constructor Details
#initialize(params) ⇒ Report
Returns a new instance of Report.
25 26 27 28 29 30 |
# File 'lib/outpost/report.rb', line 25 def initialize(params) @name = params[:name] @description = params[:description] @status = params[:status] @data = params[:data] end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
23 24 25 |
# File 'lib/outpost/report.rb', line 23 def data @data end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
23 24 25 |
# File 'lib/outpost/report.rb', line 23 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
23 24 25 |
# File 'lib/outpost/report.rb', line 23 def name @name end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
23 24 25 |
# File 'lib/outpost/report.rb', line 23 def status @status end |
Class Method Details
.summarize(status_list) ⇒ Symbol
Summarizes the list of statuses in a single status only. The logic is rather simple - it will return the lowest status present in the list.
Examples:
if passed [:up, :up, :up], will result on :up
if passed [:up, :down, :up], will result on :down
17 18 19 20 21 |
# File 'lib/outpost/report.rb', line 17 def self.summarize(status_list) return :down if status_list.empty? || status_list.include?(:down) return :warning if status_list.include?(:warning) return :up end |
Instance Method Details
#to_s ⇒ Object
32 33 34 |
# File 'lib/outpost/report.rb', line 32 def to_s "#{name}: '#{description}' is reporting #{status}." end |