Class: HealthInspector::Checklists::Base::CheckContext
- Inherits:
-
Object
- Object
- HealthInspector::Checklists::Base::CheckContext
- Includes:
- HealthInspector::Check, HealthInspector::Color
- Defined in:
- lib/health_inspector/checklists/base.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#item ⇒ Object
Returns the value of attribute item.
Instance Method Summary collapse
- #call ⇒ Object
- #diff(original, other) ⇒ Object
-
#initialize(check, item, context) ⇒ CheckContext
constructor
A new instance of CheckContext.
Methods included from HealthInspector::Check
Methods included from HealthInspector::Color
Constructor Details
#initialize(check, item, context) ⇒ CheckContext
Returns a new instance of CheckContext.
64 65 66 67 68 |
# File 'lib/health_inspector/checklists/base.rb', line 64 def initialize(check, item, context) @item = item @context = context @check = check end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
62 63 64 |
# File 'lib/health_inspector/checklists/base.rb', line 62 def context @context end |
#item ⇒ Object
Returns the value of attribute item.
62 63 64 |
# File 'lib/health_inspector/checklists/base.rb', line 62 def item @item end |
Instance Method Details
#call ⇒ Object
70 71 72 |
# File 'lib/health_inspector/checklists/base.rb', line 70 def call instance_eval(&@check) end |
#diff(original, other) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/health_inspector/checklists/base.rb', line 74 def diff(original, other) (original.keys + other.keys).uniq.inject({}) do |memo, key| unless original[key] == other[key] if original[key].kind_of?(Hash) && other[key].kind_of?(Hash) memo[key] = diff(original[key], other[key]) else memo[key] = {"server" => original[key],"local" => other[key]} end end memo end end |