Method: Refile::Attacher#initialize

Defined in:
lib/refile/attacher.rb

#initialize(record, name, cache:, store:, raise_errors: true, type: nil, extension: nil, content_type: nil) ⇒ Attacher

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Attacher.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/refile/attacher.rb', line 7

def initialize(record, name, cache:, store:, raise_errors: true, type: nil, extension: nil, content_type: nil)
  @record = record
  @name = name
  @raise_errors = raise_errors
  @cache = Refile.backends.fetch(cache.to_s)
  @store = Refile.backends.fetch(store.to_s)
  @type = type
  @extensions = [extension].flatten if extension
  @content_types = [content_type].flatten if content_type
  @content_types ||= %w[image/jpeg image/gif image/png] if type == :image
  @errors = []
end