Module: MiniPaperclip

Defined in:
lib/mini_paperclip.rb,
lib/mini_paperclip/config.rb,
lib/mini_paperclip/version.rb,
lib/mini_paperclip/attachment.rb,
lib/mini_paperclip/storage/s3.rb,
lib/mini_paperclip/interpolator.rb,
lib/mini_paperclip/storage/base.rb,
lib/mini_paperclip/class_methods.rb,
lib/mini_paperclip/storage/filesystem.rb,
lib/mini_paperclip/validators/geometry_validator.rb,
lib/mini_paperclip/validators/presence_validator.rb,
lib/mini_paperclip/validators/file_size_validator.rb,
lib/mini_paperclip/validators/content_type_validator.rb,
lib/mini_paperclip/validators/media_type_spoof_validator.rb,
lib/mini_paperclip/shoulda/matchers/have_attached_file_matcher.rb,
lib/mini_paperclip/shoulda/matchers/validate_attachment_size_matcher.rb,
lib/mini_paperclip/shoulda/matchers/validate_attachment_geometry_matcher.rb,
lib/mini_paperclip/shoulda/matchers/validate_attachment_presence_matcher.rb,
lib/mini_paperclip/shoulda/matchers/validate_attachment_content_type_matcher.rb

Defined Under Namespace

Modules: ClassMethods, Shoulda, Storage, Validators Classes: Attachment, Config, Interpolator

Constant Summary collapse

VERSION =
"0.4.0"

Class Method Summary collapse

Class Method Details

.configObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/mini_paperclip.rb', line 23

def config
  @config ||= Config.new(
    # defaults
    interpolates: {
      ':class' => ->(_) { class_result },
      ':attachment' => ->(_) { attachment_result },
      ':hash' => ->(style) { hash_key(style) },
      ':extension' => ->(_) { extension },
      ':id' => ->(_) { @attachment.record.id },
      ':updated_at' => ->(_) { attachment.updated_at&.to_i },
      ':style' => ->(style) { style }
    },
    hash_data: ":class/:attachment/:id/:style/:updated_at",
    url_missing_path: ":attachment/:style/missing.png",
    keep_old_files: false,
    read_timeout: 60,
    logger: Logger.new($stdout),
  )
end