Class: Insta::UpdateCoordinator

Inherits:
Object
  • Object
show all
Defined in:
lib/insta/update_coordinator.rb,
sig/insta/update_coordinator.rbs

Instance Method Summary collapse

Constructor Details

#initialize(mode) ⇒ UpdateCoordinator

: (Symbol) -> void

Parameters:

  • (Symbol)


6
7
8
# File 'lib/insta/update_coordinator.rb', line 6

def initialize(mode)
  @mode = mode
end

Instance Method Details

#resolve(expected, actual) ⇒ Symbol

: (String, String) -> Symbol

Parameters:

  • (String)
  • (String)

Returns:

  • (Symbol)


11
12
13
14
15
16
17
18
19
20
# File 'lib/insta/update_coordinator.rb', line 11

def resolve(expected, actual)
  return :keep if expected == actual

  case @mode
  when :force then :update
  when :new then expected.empty? ? :update : :fail
  when :no then :fail
  else :pending # :auto, :pending => default to creating .snap.new
  end
end