Class: Chrysalis::Cache

Inherits:
Object show all
Includes:
Singleton
Defined in:
lib/chrysalis/manifest.rb

Overview

Stores the results of retrieving a working copy from a repository. – The cache is implemented as hash, where each URL-based key serves as an index to another hash. The entire structure is serialized to the cache file. When deserializing, the structure is used to instantiate WorkingCopy instances, effectively recovering the state of previously retrieved working copies.

Instance Method Summary collapse

Constructor Details

#initializeCache

:nodoc:



64
65
66
67
# File 'lib/chrysalis/manifest.rb', line 64

def initialize  # :nodoc:
  @hash = {}
  load
end

Instance Method Details

#[](url) ⇒ Object



69
70
71
# File 'lib/chrysalis/manifest.rb', line 69

def [](url)
  @hash[url]
end

#[]=(url, working_copy) ⇒ Object



73
74
75
76
# File 'lib/chrysalis/manifest.rb', line 73

def []=(url, working_copy)
  @hash[url] = working_copy.to_hash
  serialize
end