Class: Foundries::Snapshot::Fingerprint

Inherits:
Object
  • Object
show all
Defined in:
lib/foundries/snapshot/fingerprint.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection, source_paths: []) ⇒ Fingerprint

Returns a new instance of Fingerprint.



6
7
8
9
# File 'lib/foundries/snapshot/fingerprint.rb', line 6

def initialize(connection, source_paths: [])
  @connection = connection
  @source_paths = Array(source_paths)
end

Instance Method Details

#currentObject



11
12
13
14
15
16
17
18
# File 'lib/foundries/snapshot/fingerprint.rb', line 11

def current
  digest = Digest::MD5.new
  digest.update(schema_version)
  @source_paths.sort.each do |path|
    digest.update(File.read(path)) if File.exist?(path)
  end
  digest.hexdigest
end