Module: Shrine::Plugins::DefaultStorage::AttacherMethods

Defined in:
lib/shrine/plugins/default_storage.rb

Instance Method Summary collapse

Instance Method Details

#initialize(record, name, **options) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/shrine/plugins/default_storage.rb', line 15

def initialize(record, name, **options)
  if cache = shrine_class.opts[:default_storage_cache]
    cache = cache.call(record, name) if cache.respond_to?(:call)
    options[:cache] = cache
  end

  if store = shrine_class.opts[:default_storage_store]
    store = store.call(record, name) if store.respond_to?(:call)
    options[:store] = store
  end

  super
end