Module ActiveResource::Formats::XmlFormat
In: activeresource/lib/active_resource/formats/xml_format.rb

Methods

Public Instance methods

[Source]

# File activeresource/lib/active_resource/formats/xml_format.rb, line 18
      def decode(xml)
        from_xml_data(Hash.from_xml(xml))
      end

[Source]

# File activeresource/lib/active_resource/formats/xml_format.rb, line 14
      def encode(hash)
        hash.to_xml
      end

[Source]

# File activeresource/lib/active_resource/formats/xml_format.rb, line 6
      def extension
        "xml"
      end

[Source]

# File activeresource/lib/active_resource/formats/xml_format.rb, line 10
      def mime_type
        "application/xml"
      end

Private Instance methods

Manipulate from_xml Hash, because xml_simple is not exactly what we want for ActiveResource.

[Source]

# File activeresource/lib/active_resource/formats/xml_format.rb, line 25
        def from_xml_data(data)
          if data.is_a?(Hash) && data.keys.size == 1
            data.values.first
          else
            data
          end
        end

[Validate]