Sha256: 80edda9b6ae35c56707bfdd06438b730b3cd6deb742139a1b841aa04774d06ec

Contents?: true

Size: 849 Bytes

Versions: 13

Compression:

Stored size: 849 Bytes

Contents

module Refile
  # A type represents an alias for one or multiple content types.
  # By adding types, you could simplify this:
  #
  #     attachment :document, content_type: %w[text/plain application/pdf]
  #
  # To this:
  #
  #     attachment :document, type: :document
  #
  # Simply define a new type like this:
  #
  #     Refile.types[:document] = Refile::Type.new(:document,
  #       content_type: %w[text/plain application/pdf]
  #     )
  #
  class Type
    # @return [String, Array<String>] The type's content types
    attr_accessor :content_type

    # @param [Symbol] name                            the name of the type
    # @param [String, Array<String>] content_type     content types which are valid for this type
    def initialize(name, content_type: nil)
      @name = name
      @content_type = content_type
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
leifcr-refile-0.7.3 lib/refile/type.rb
leifcr-refile-0.7.1 lib/refile/type.rb
leifcr-refile-0.7.0 lib/refile/type.rb
leifcr-refile-0.6.3 lib/refile/type.rb
refile-0.6.2 lib/refile/type.rb
refile-0.6.1 lib/refile/type.rb
refile-0.6.0 lib/refile/type.rb
refile-0.5.5 lib/refile/type.rb
refile-0.5.4 lib/refile/type.rb
refile-0.5.3 lib/refile/type.rb
refile-0.5.2 lib/refile/type.rb
refile-0.5.1 lib/refile/type.rb
refile-0.5.0 lib/refile/type.rb