Class: StaticSync::StorageCache

Inherits:
Object
  • Object
show all
Defined in:
lib/static_sync/storage_cache.rb

Defined Under Namespace

Classes: Version

Instance Method Summary collapse

Constructor Details

#initialize(versions) ⇒ StorageCache

Returns a new instance of StorageCache.



7
8
9
# File 'lib/static_sync/storage_cache.rb', line 7

def initialize(versions)
  @versions = versions
end

Instance Method Details

#has_conflict?(file) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
26
27
# File 'lib/static_sync/storage_cache.rb', line 23

def has_conflict?(file)
  @versions.any? do |version|
    file.path == version.path && file.etag != version.etag
  end
end

#has_file?(file) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
15
# File 'lib/static_sync/storage_cache.rb', line 11

def has_file?(file)
  @versions.any? do |version|
    file.path == version.path
  end
end

#has_version?(file) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
20
21
# File 'lib/static_sync/storage_cache.rb', line 17

def has_version?(file)
  @versions.any? do |version|
    file.path == version.path && file.etag == version.etag
  end
end