Method: Listen::QueueOptimizer#_reinterpret_related_changes

Defined in:
lib/listen/queue_optimizer.rb

remove extraneous rb-inotify events, keeping them only if it's a possible editor rename() call (e.g. Kate and Sublime)



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/listen/queue_optimizer.rb', line 71

def _reinterpret_related_changes(cookies)
  table = { moved_to: :added, moved_from: :removed }
  cookies.map do |_, changes|
    data = _detect_possible_editor_save(changes)
    if data
      to_dir, to_file = data
      [[:modified, to_dir, to_file]]
    else
      not_silenced = changes.reject do |type, _, _, path, _|
        _silenced?(Pathname(path), type)
      end
      not_silenced.map do |_, change, dir, path, _|
        [table.fetch(change, change), dir, path]
      end
    end
  end.flatten(1)
end