class Mv::Core::Services::SynchronizeConstraints
Attributes
additions[R]
deletions[R]
updates[R]
Public Class Methods
new(additions, updates, deletions)
click to toggle source
# File lib/mv/core/services/synchronize_constraints.rb, line 10 def initialize(additions, updates, deletions) @additions = additions @updates = updates @deletions = deletions end
Public Instance Methods
execute()
click to toggle source
# File lib/mv/core/services/synchronize_constraints.rb, line 16 def execute delete update create end
Private Instance Methods
builder(constraint)
click to toggle source
# File lib/mv/core/services/synchronize_constraints.rb, line 24 def builder(constraint) Mv::Core::Constraint::Builder::Factory.create_builder(constraint) end
create()
click to toggle source
# File lib/mv/core/services/synchronize_constraints.rb, line 44 def create additions.each do |constraint_to_be_added| Mv::Core::Services::SayConstraintsDiff.new(nil, constraint_to_be_added).execute do builder(constraint_to_be_added).create end end if additions end
delete()
click to toggle source
# File lib/mv/core/services/synchronize_constraints.rb, line 28 def delete deletions.each do |constraint_to_delete| Mv::Core::Services::SayConstraintsDiff.new(constraint_to_delete, nil).execute do builder(constraint_to_delete).delete end end if deletions end
update()
click to toggle source
# File lib/mv/core/services/synchronize_constraints.rb, line 36 def update updates.each do |old_constraint, new_constraint| Mv::Core::Services::SayConstraintsDiff.new(old_constraint, new_constraint).execute do builder(old_constraint).update(builder(new_constraint)) end end if updates end