Add XML renderer
This commit is contained in:
parent
213043589b
commit
9364803048
13
lib/rabl-rails/renderers/xml.rb
Normal file
13
lib/rabl-rails/renderers/xml.rb
Normal file
@ -0,0 +1,13 @@
|
||||
module RablRails
|
||||
module Renderers
|
||||
class XML < Base
|
||||
DEFAULT_OPTIONS = { dasherize: true, skip_types: false }
|
||||
|
||||
def format_output(hash)
|
||||
# hash = hash[options[:root_name]] if options[:root_name]
|
||||
xml_options = { root: options[:root_name] }.merge!(DEFAULT_OPTIONS)
|
||||
hash.to_xml(xml_options)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user