Module: Nestful::Formats

Defined in:
lib/nestful/formats.rb,
lib/nestful/formats/xml_format.rb,
lib/nestful/formats/form_format.rb,
lib/nestful/formats/json_format.rb,
lib/nestful/formats/text_format.rb,
lib/nestful/formats/blank_format.rb,
lib/nestful/formats/multipart_format.rb

Defined Under Namespace

Classes: BlankFormat, FormFormat, Format, JsonFormat, MultipartFormat, TextFormat, XmlFormat

Class Method Summary collapse

Class Method Details

.[](mime_type_reference) ⇒ Object

Lookup the format class from a mime type reference symbol. Example:

Nestful::Formats[:xml]  # => Nestful::Formats::XmlFormat
Nestful::Formats[:json] # => Nestful::Formats::JsonFormat


28
29
30
# File 'lib/nestful/formats.rb', line 28

def self.[](mime_type_reference)
  Nestful::Formats.const_get(ActiveSupport::Inflector.camelize(mime_type_reference.to_s) + "Format")
end