class Dragonfly::MemoryDataStore
Attributes
content_store[R]
Public Class Methods
new()
click to toggle source
# File lib/dragonfly/memory_data_store.rb, line 4 def initialize @content_store = {} end
Public Instance Methods
destroy(uid)
click to toggle source
# File lib/dragonfly/memory_data_store.rb, line 19 def destroy(uid) content_store.delete(uid) end
read(uid)
click to toggle source
# File lib/dragonfly/memory_data_store.rb, line 14 def read(uid) data = content_store[uid] [data[:content], data[:meta]] if data end
write(content, opts={})
click to toggle source
# File lib/dragonfly/memory_data_store.rb, line 8 def write(content, opts={}) uid = opts[:uid] || generate_uid content_store[uid] = {:content => content.data, :meta => content.meta.dup} uid end
Private Instance Methods
generate_uid()
click to toggle source
# File lib/dragonfly/memory_data_store.rb, line 27 def generate_uid @uid_count ||= 0 @uid_count += 1 @uid_count.to_s end