Method: Docks::Cache#dump

Defined in:
lib/docks/cache.rb

#dumpObject



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/docks/cache.rb', line 89

def dump
  Process.process(@pattern_library)

  File.open(self.class.pattern_library_cache_file, "wb") do |file|
    file.write Marshal::dump(@pattern_library)
  end

  File.open(self.class.meta_file, "wb") do |file|
    file.write Marshal::dump()
  end

  @patterns_needing_caches.each do |pattern|
    File.open(Docks.config.cache_location + pattern, "wb") do |file|
      file.write Marshal::dump(@pattern_library[pattern])
    end
  end

  # Clear out anything that didn't get written to the new cache
  @old_pattern_library.patterns.each do |name, pattern|
    FileUtils.rm_rf(Docks.config.cache_location + name) unless @pattern_library.has_pattern?(name)
  end
end