Sha256: 4ca356a2a9239de21797adfdf277b34098a307fcb586c166f950b2ae71894a4b
Contents?: true
Size: 787 Bytes
Versions: 10
Compression:
Stored size: 787 Bytes
Contents
# frozen_string_literal: true module ActiveResource module Formats autoload :XmlFormat, "#{__dir__}/formats/xml_format.rb" autoload :JsonFormat, "#{__dir__}/formats/json_format.rb" # 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(ActiveSupport::Inflector.camelize(mime_type_reference.to_s) + "Format") end def self.remove_root(data) if data.is_a?(Hash) && data.keys.size == 1 && data.values.first.is_a?(Enumerable) data.values.first else data end end end end
Version data entries
10 entries across 10 versions & 1 rubygems