Class: Refile::Type

Inherits:
Object
  • Object
show all
Defined in:
lib/refile/type.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, content_type: nil) ⇒ Type



23
24
25
26
# File 'lib/refile/type.rb', line 23

def initialize(name, content_type: nil)
  @name = name
  @content_type = content_type
end

Instance Attribute Details

#content_typeString+



19
20
21
# File 'lib/refile/type.rb', line 19

def content_type
  @content_type
end