Module: Porth::Format::XML

Defined in:
lib/porth/format/xml.rb

Defined Under Namespace

Modules: ControllerExtensions

Class Method Summary collapse

Class Method Details

.call(controller, object) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/porth/format/xml.rb', line 4

def self.call controller, object
  method = if object.respond_to?(:count) && !object.respond_to?(:keys)
    :xml_pluralized_root
  else
    :xml_singularized_root
  end
  object.to_xml :root => controller.send(method)
end