Class: Dragonfly::FileDataStore::MetaStore

Inherits:
Object
  • Object
show all
Defined in:
lib/dragonfly/file_data_store.rb

Direct Known Subclasses

MarshalMetaStore, YAMLMetaStore

Instance Method Summary collapse

Instance Method Details

#destroy(path) ⇒ Object



25
26
27
# File 'lib/dragonfly/file_data_store.rb', line 25

def destroy(path)
  FileUtils.rm_f meta_path(path)
end

#read(data_path) ⇒ Object



20
21
22
23
# File 'lib/dragonfly/file_data_store.rb', line 20

def read(data_path)
  path = meta_path(data_path)
  File.open(path,'rb'){|f| load(f.read) } if File.exist?(path)
end

#write(data_path, meta) ⇒ Object



14
15
16
17
18
# File 'lib/dragonfly/file_data_store.rb', line 14

def write(data_path, meta)
  File.open(meta_path(data_path), 'wb') do |f|
    f.write dump(meta)
  end
end