Class: Diagnostics::Check
Instance Attribute Summary collapse
-
#cls ⇒ Object
Returns the value of attribute cls.
Class Method Summary collapse
Instance Method Summary collapse
- #data ⇒ Object
- #failed? ⇒ Boolean
- #instance ⇒ Object
- #name ⇒ Object
- #passed? ⇒ Boolean
- #status ⇒ Object
- #warning? ⇒ Boolean
Instance Attribute Details
#cls ⇒ Object
Returns the value of attribute cls
2 3 4 |
# File 'lib/diagnostics/check.rb', line 2 def cls @cls end |
Class Method Details
.add(cls) ⇒ Object
4 5 6 7 |
# File 'lib/diagnostics/check.rb', line 4 def self.add(cls) Diagnostics.checks << check = new(cls) check end |
.find(name) ⇒ Object
9 10 11 |
# File 'lib/diagnostics/check.rb', line 9 def self.find(name) Diagnostics.checks.select {|c| c.name == name.to_s }[0] end |
Instance Method Details
#data ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/diagnostics/check.rb', line 42 def data @data_method_result ||= if instance.respond_to?(:data) instance.data.call(data_group) && data_group else data_group end end |
#failed? ⇒ Boolean
29 30 31 32 33 |
# File 'lib/diagnostics/check.rb', line 29 def failed? @failed_method_result ||= call_method(:failed) || ( !passed? if instance.respond_to?(:passed) ) end |
#instance ⇒ Object
17 18 19 |
# File 'lib/diagnostics/check.rb', line 17 def instance @instance ||= cls.new end |
#name ⇒ Object
13 14 15 |
# File 'lib/diagnostics/check.rb', line 13 def name cls.name end |
#passed? ⇒ Boolean
21 22 23 |
# File 'lib/diagnostics/check.rb', line 21 def passed? @passed_method_result ||= call_method(:passed) end |
#status ⇒ Object
35 36 37 38 39 40 |
# File 'lib/diagnostics/check.rb', line 35 def status return :passed if passed? return :warning if warning? return :failed if failed? :none end |
#warning? ⇒ Boolean
25 26 27 |
# File 'lib/diagnostics/check.rb', line 25 def warning? @warning_method_result ||= call_method(:warning) end |