Class: Apical::ContentType

Inherits:
Object
  • Object
show all
Defined in:
lib/apical/content_types.rb

Direct Known Subclasses

FormContentType, JsonContentType

Class Method Summary collapse

Class Method Details

.[](format) ⇒ Object



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

def self.[](format)
  @@registry ||= {}
  klass = @@registry[format]
  raise "Content type '#{format}' does not exist." unless klass

  klass.new
end

.format(format) ⇒ Object



13
14
15
16
17
# File 'lib/apical/content_types.rb', line 13

def self.format(format)
  @format = format
  @@registry ||= {}
  @@registry[format] = self
end