Class: Yarrow::Format::ContentType

Inherits:
Object
  • Object
show all
Defined in:
lib/yarrow/format.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ ContentType

Returns a new instance of ContentType.



30
31
32
# File 'lib/yarrow/format.rb', line 30

def initialize(source)
  @source = source
end

Class Method Details

.[](*extensions) ⇒ Object



15
16
17
18
# File 'lib/yarrow/format.rb', line 15

def self.[](*extensions)
  @@extensions_cache = extensions
  self
end

.inherited(media_type) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/yarrow/format.rb', line 20

def self.inherited(media_type)
  return if @@extensions_cache.nil?

  @@extensions_cache.each do |extname|
    Registry[extname] = media_type
  end

  @@extensions_cache = nil
end

Instance Method Details

#to_sObject



34
35
36
# File 'lib/yarrow/format.rb', line 34

def to_s
  @source
end