Class: Rack::ECG::Check::Static
- Inherits:
-
Object
- Object
- Rack::ECG::Check::Static
- Defined in:
- lib/rack/ecg/check/static.rb
Instance Method Summary collapse
-
#initialize(parameters) ⇒ Static
constructor
Always returns the provided
value
under thename
key, with the result set bystatus
. - #result ⇒ Object
Constructor Details
#initialize(parameters) ⇒ Static
Always returns the provided value
under the name
key, with the result set by status
.
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rack/ecg/check/static.rb', line 31 def initialize(parameters) parameters ||= {} @name = parameters.fetch(:name, :static).to_sym @value = parameters.fetch(:value, nil) @status = if parameters.key?(:status) parameters[:status] else parameters.fetch(:success, true) ? Status::OK : Status::ERROR end end |
Instance Method Details
#result ⇒ Object
44 45 46 |
# File 'lib/rack/ecg/check/static.rb', line 44 def result Result.new(@name, @status, @value) end |