Sha256: 3970ea5ea4daaa901256b88224f7179d4885453be768b69bb140b4155538095d

Contents?: true

Size: 560 Bytes

Versions: 12

Compression:

Stored size: 560 Bytes

Contents

module ApiResource
  module Formats
    autoload :XmlFormat, 'api_resource/formats/xml_format'
    autoload :JsonFormat, 'api_resource/formats/json_format'

    # Lookup the format class from a mime type reference symbol. Example:
    #
    #   ActiveResource::Formats[:xml]  # => ActiveResource::Formats::XmlFormat
    #   ActiveResource::Formats[:json] # => ActiveResource::Formats::JsonFormat
    def self.[](mime_type_reference)
      ApiResource::Formats.const_get(ActiveSupport::Inflector.camelize(mime_type_reference.to_s) + "Format")
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
api_resource-0.2.11 lib/api_resource/formats.rb
api_resource-0.2.10 lib/api_resource/formats.rb
api_resource-0.2.9 lib/api_resource/formats.rb
api_resource-0.2.8 lib/api_resource/formats.rb
api_resource-0.2.7 lib/api_resource/formats.rb
api_resource-0.2.6 lib/api_resource/formats.rb
api_resource-0.2.5 lib/api_resource/formats.rb
api_resource-0.2.4 lib/api_resource/formats.rb
api_resource-0.2.3 lib/api_resource/formats.rb
api_resource-0.2.2 lib/api_resource/formats.rb
api_resource-0.2.1 lib/api_resource/formats.rb
resource-0.1.0 lib/api_resource/formats.rb