Module: Shrine::Plugins::CortexValidationHelpers::AttacherMethods

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

Instance Method Summary collapse

Instance Method Details

#allowed_content_typesObject



13
14
15
16
17
# File 'lib/shrine/plugins/cortex_validation_helpers.rb', line 13

def allowed_content_types
  validations[:allowed_extensions].collect do |allowed_content_type|
    MimeMagic.by_extension(allowed_content_type).type
  end
end

#validate?(validation) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/shrine/plugins/cortex_validation_helpers.rb', line 9

def validate?(validation)
  validations.key? validation
end

#validationsObject



5
6
7
# File 'lib/shrine/plugins/cortex_validation_helpers.rb', line 5

def validations
  context[:config][:validations]
end