Class: MediaTypes::Registerable

Inherits:
Object
  • Object
show all
Defined in:
lib/media_types/registrar.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(media_type, symbol:, aliases: []) ⇒ Registerable

Returns a new instance of Registerable.



5
6
7
8
9
10
11
# File 'lib/media_types/registrar.rb', line 5

def initialize(media_type, symbol:, aliases: [])
  self.media_type = media_type
  self.symbol = symbol
  self.aliases = aliases

  freeze
end

Instance Attribute Details

#aliasesObject Also known as: synonyms

Returns the value of attribute aliases.



21
22
23
# File 'lib/media_types/registrar.rb', line 21

def aliases
  @aliases
end

#media_typeObject

Returns the value of attribute media_type.



21
22
23
# File 'lib/media_types/registrar.rb', line 21

def media_type
  @media_type
end

#symbolObject

Returns the value of attribute symbol.



21
22
23
# File 'lib/media_types/registrar.rb', line 21

def symbol
  @symbol
end

Instance Method Details

#to_sObject Also known as: mime_type



13
14
15
# File 'lib/media_types/registrar.rb', line 13

def to_s
  String(media_type)
end

#to_symObject



17
18
19
# File 'lib/media_types/registrar.rb', line 17

def to_sym
  symbol
end