Class: Photish::Cache::DbFile
- Inherits:
-
Object
- Object
- Photish::Cache::DbFile
- Defined in:
- lib/photish/cache/db_file.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.new_master(output_dir) ⇒ Object
4 5 6 |
# File 'lib/photish/cache/db_file.rb', line 4 def self.new_master(output_dir) new(path(output_dir, '.changes.yml')) end |
.new_worker(output_dir, index) ⇒ Object
8 9 10 |
# File 'lib/photish/cache/db_file.rb', line 8 def self.new_worker(output_dir, index) new(path(output_dir, ".changes.#{index}.yml")) end |
Instance Method Details
#clear ⇒ Object
22 23 24 |
# File 'lib/photish/cache/db_file.rb', line 22 def clear FileUtils.rm_rf(file) end |
#read ⇒ Object
18 19 20 |
# File 'lib/photish/cache/db_file.rb', line 18 def read File.exist?(file) ? YAML.load_file(file) : {} end |
#write(hash) ⇒ Object
12 13 14 15 16 |
# File 'lib/photish/cache/db_file.rb', line 12 def write(hash) File.open(file, 'w') do |f| f.write(hash.to_yaml) end end |