Class: Mv::Core::Services::CompareConstraints
- Inherits:
-
Object
- Object
- Mv::Core::Services::CompareConstraints
- Defined in:
- lib/mv/core/services/compare_constraints.rb
Instance Attribute Summary collapse
-
#new_constraint ⇒ Object
readonly
Returns the value of attribute new_constraint.
-
#old_constraint ⇒ Object
readonly
Returns the value of attribute old_constraint.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(old_constraint, new_constraint) ⇒ CompareConstraints
constructor
A new instance of CompareConstraints.
Constructor Details
#initialize(old_constraint, new_constraint) ⇒ CompareConstraints
Returns a new instance of CompareConstraints.
7 8 9 10 |
# File 'lib/mv/core/services/compare_constraints.rb', line 7 def initialize(old_constraint, new_constraint) @old_constraint = old_constraint @new_constraint = new_constraint end |
Instance Attribute Details
#new_constraint ⇒ Object (readonly)
Returns the value of attribute new_constraint.
5 6 7 |
# File 'lib/mv/core/services/compare_constraints.rb', line 5 def new_constraint @new_constraint end |
#old_constraint ⇒ Object (readonly)
Returns the value of attribute old_constraint.
5 6 7 |
# File 'lib/mv/core/services/compare_constraints.rb', line 5 def old_constraint @old_constraint end |
Instance Method Details
#execute ⇒ Object
12 13 14 15 16 17 |
# File 'lib/mv/core/services/compare_constraints.rb', line 12 def execute { deleted: old_validations - new_validations, added: new_validations - old_validations }.delete_if{ |key, value| value.blank? } end |