Module: MIME::Types::Columnar
- Defined in:
- lib/mime/types/columnar.rb
Overview
MIME::Types::Columnar is used to extend a MIME::Types container to load data by columns instead of from JSON or YAML. Column loads of MIME types loaded through the columnar store are synchronized with a Mutex.
MIME::Types::Columnar is not intended to be used directly, but will be added to an instance of MIME::Types when it is loaded with MIME::Types::Loader#load_columnar.
Constant Summary collapse
- LOAD_MUTEX =
:nodoc:
Mutex.new
Class Method Summary collapse
-
.extended(obj) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#load_base_data(path) ⇒ Object
Load the first column data file (type and extensions).
Class Method Details
.extended(obj) ⇒ Object
:nodoc:
18 19 20 21 22 |
# File 'lib/mime/types/columnar.rb', line 18 def self.extended(obj) # :nodoc: super obj.instance_variable_set(:@__mime_data__, []) obj.instance_variable_set(:@__attributes__, []) end |
Instance Method Details
#load_base_data(path) ⇒ Object
Load the first column data file (type and extensions).
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/mime/types/columnar.rb', line 25 def load_base_data(path) #:nodoc: @__root__ = path each_file_line('content_type', false) do |line| content_type, *extensions = line.split type = MIME::Type::Columnar.new(self, content_type, extensions) @__mime_data__ << type add(type) end self end |