Sha256: cca2b56591854086c110774d9ffedca235a95726c148eeb531637eb82347189f

Contents?: true

Size: 558 Bytes

Versions: 14

Compression:

Stored size: 558 Bytes

Contents

class Shrine
  module Plugins
    module CortexValidationHelpers
      module AttacherMethods
        def validations
          context[:config][:validations]
        end

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

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

    register_plugin(:cortex_validation_helpers, CortexValidationHelpers)
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
cortex-plugins-core-3.2.0 lib/shrine/plugins/cortex_validation_helpers.rb
cortex-plugins-core-3.1.0 lib/shrine/plugins/cortex_validation_helpers.rb
cortex-plugins-core-3.0.0 lib/shrine/plugins/cortex_validation_helpers.rb
cortex-plugins-core-2.1.1 lib/shrine/plugins/cortex_validation_helpers.rb
cortex-plugins-core-2.1.0 lib/shrine/plugins/cortex_validation_helpers.rb
cortex-plugins-core-2.0.1 lib/shrine/plugins/cortex_validation_helpers.rb
cortex-plugins-core-1.1.1 lib/shrine/plugins/cortex_validation_helpers.rb
cortex-plugins-core-1.1.0 lib/shrine/plugins/cortex_validation_helpers.rb
cortex-plugins-core-1.0.0 lib/shrine/plugins/cortex_validation_helpers.rb
cortex-plugins-core-0.12.4 lib/shrine/plugins/cortex_validation_helpers.rb
cortex-plugins-core-0.12.3 lib/shrine/plugins/cortex_validation_helpers.rb
cortex-plugins-core-0.12.2 lib/shrine/plugins/cortex_validation_helpers.rb
cortex-plugins-core-0.12.1 lib/shrine/plugins/cortex_validation_helpers.rb
cortex-plugins-core-0.12.0 lib/shrine/plugins/cortex_validation_helpers.rb