Class: Mt::Wall::Plan::Differ

Inherits:
Object
  • Object
show all
Defined in:
lib/mt/wall/plan.rb

Overview

Computes the ordered operation list for diff. Stateful, single-use: accumulates operations in document order, then sorts them once per the apply-order invariants.

Instance Method Summary collapse

Constructor Details

#initialize(desired:, current:) ⇒ Differ

rubocop:disable Metrics/ClassLength



90
91
92
93
94
# File 'lib/mt/wall/plan.rb', line 90

def initialize(desired:, current:)
  @desired = desired
  @current = current
  @operations = []
end

Instance Method Details

#callPlan

Returns:



97
98
99
100
101
# File 'lib/mt/wall/plan.rb', line 97

def call
  DesiredState::FULL_TABLE_PATHS.each { |path| diff_full_table(path) }
  DesiredState::ADDRESS_LIST_PATHS.each { |path| diff_address_list(path) }
  Plan.new(sorted_operations)
end