class Refile::Type

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]
)

Attributes

content_type[RW]

@return [String, Array<String>] The type's content types

Public Class Methods

new(name, content_type: nil) click to toggle source

@param [Symbol] name the name of the type @param [String, Array<String>] content_type content types which are valid for this type

# File lib/refile/type.rb, line 23
def initialize(name, content_type: nil)
  @name = name
  @content_type = content_type
end