mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
dc399b96c8
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7518 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
14 lines
No EOL
510 B
Ruby
14 lines
No EOL
510 B
Ruby
module ActiveResource
|
|
module Formats
|
|
# 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)
|
|
ActiveResource::Formats.const_get(mime_type_reference.to_s.camelize + "Format")
|
|
end
|
|
end
|
|
end
|
|
|
|
require 'active_resource/formats/xml_format'
|
|
require 'active_resource/formats/json_format' |