Module: Dyph::Support::AssignAction

Extended by:
AssignAction
Included in:
AssignAction
Defined in:
lib/dyph/support/assign_action.rb

Class Method Summary collapse

Class Method Details

.get_action(lo_a:, lo_b:, hi_a:, hi_b:) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/dyph/support/assign_action.rb', line 5

def self.get_action(lo_a:, lo_b:, hi_a:, hi_b:)
  if lo_a <= hi_a && lo_b <= hi_b # for this change, the bounds are both 'normal'.  the beginning of the change is before the end.
    [:change, lo_a + 1, hi_a + 1, lo_b + 1, hi_b + 1]
  elsif lo_a <= hi_a
    [:delete, lo_a + 1, hi_a + 1, lo_b + 1, lo_b]
  elsif lo_b <= hi_b
    [:add, lo_a + 1, lo_a, lo_b + 1, hi_b + 1]
  else
    nil
  end
end