Class: MIME::Type::Columnar

Inherits:
MIME::Type show all
Defined in:
lib/mime/type/columnar.rb

Overview

A version of MIME::Type that works hand-in-hand with a MIME::Types::Columnar container to load data by columns.

When a field is has not yet been loaded, that data will be loaded for all types in the container before forwarding the message to MIME::Type.

More information can be found in MIME::Types::Columnar.

MIME::Type::Columnar is not intended to be created except by MIME::Types::Columnar containers.

Constant Summary

Constants inherited from MIME::Type

VERSION

Instance Attribute Summary

Attributes inherited from MIME::Type

#content_type, #docs, #encoding, #i18n_key, #media_type, #obsolete, #provisional, #raw_media_type, #raw_sub_type, #registered, #signature, #simplified, #sub_type, #use_instead, #xrefs

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from MIME::Type

#<=>, #add_extensions, #ascii?, #binary?, #complete?, #default_encoding, #eql?, #extensions, #extensions=, #friendly, #hash, i18n_key, #init_with, #inspect, #like?, match, #preferred_extension, #preferred_extension=, #priority_compare, #provisional?, simplified, #to_h, #to_json, #to_s, #to_str, #xref_urls

Constructor Details

#initialize(container, content_type, extensions) ⇒ Columnar

:nodoc:



16
17
18
19
20
# File 'lib/mime/type/columnar.rb', line 16

def initialize(container, content_type, extensions) # :nodoc:
  @container = container
  self.content_type = content_type
  self.extensions = extensions
end

Class Method Details

.column(*methods, file: nil) ⇒ Object

:nodoc:



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/mime/type/columnar.rb', line 22

def self.column(*methods, file: nil) # :nodoc:
  file ||= methods.first

  file_method = :"load_#{file}"
  methods.each do |m|
    define_method m do |*args|
      @container.send(file_method)
      super(*args)
    end
  end
end

Instance Method Details

#encode_with(coder) ⇒ Object

:nodoc:



43
44
45
46
47
48
49
50
51
52
# File 'lib/mime/type/columnar.rb', line 43

def encode_with(coder) # :nodoc:
  @container.send(:load_friendly)
  @container.send(:load_encoding)
  @container.send(:load_docs)
  @container.send(:load_flags)
  @container.send(:load_use_instead)
  @container.send(:load_xrefs)
  @container.send(:load_preferred_extension)
  super
end