class Filewatcher::Snapshot

Class for snapshots of file system

Public Class Methods

new(filenames) click to toggle source
# File lib/filewatcher/snapshot.rb, line 11
def initialize(filenames)
  @data = filenames.each_with_object({}) do |filename, data|
    data[filename] = SnapshotFile.new(filename)
  end
end

Public Instance Methods

-(other) click to toggle source
# File lib/filewatcher/snapshot.rb, line 17
def -(other)
  changes = {}

  each do |filename, snapshot_file|
    changes[filename] = snapshot_file - other[filename]
  end

  other.each do |filename, _snapshot_file|
    changes[filename] = :deleted unless self[filename]
  end

  changes.tap(&:compact!)
end