Class: DirSync::ChangeResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/dir_sync/change_resolver.rb

Instance Method Summary collapse

Constructor Details

#initialize(history, *traversers) ⇒ ChangeResolver

Returns a new instance of ChangeResolver.



9
10
11
# File 'lib/dir_sync/change_resolver.rb', line 9

def initialize history, *traversers
  @history, @traversers = history, traversers
end

Instance Method Details

#candidateObject



22
23
24
# File 'lib/dir_sync/change_resolver.rb', line 22

def candidate
  candidates.first
end

#debug(message) ⇒ Object



5
6
7
# File 'lib/dir_sync/change_resolver.rb', line 5

def debug message
  puts "# #{message}" if ENV['DEBUG']
end

#iterateObject



13
14
15
16
17
18
19
20
# File 'lib/dir_sync/change_resolver.rb', line 13

def iterate
  report_traversers
  first = candidates.first
  return false unless first
  debug "first is #{first.description}"
  send dispatch(first), first
  advance_matching_traversers first.name, @history, *non_empty_traversers
end