Module: ROM::Files::Dataset::MimeType

Included in:
ROM::Files::Dataset
Defined in:
lib/rom/files/dataset/mime_type.rb

Defined Under Namespace

Modules: Initializer

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#mime_typeMIME::Type? (readonly)

MIME-type of files to include

Returns:

  • (MIME::Type?)


# File 'lib/rom/files/dataset/mime_type.rb', line 31

Class Method Details

.included(other) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/rom/files/dataset/mime_type.rb', line 10

def self.included(other)
  super(other)
  other.module_eval do
    option :mime_type, Types::MimeType.optional,
           default: -> { nil }

    prepend Initializer
  end
end

Instance Method Details

#mime(type = nil) ⇒ Dataset

Parameters:

  • type (String, nil) (defaults to: nil)

Returns:



37
38
39
40
# File 'lib/rom/files/dataset/mime_type.rb', line 37

def mime(type = nil)
  type = Types::MimeType[type] if type
  with(mime_type: type)
end