Class: Raw::RSSFormat
Instance Attribute Summary
Attributes inherited from Format
#content_type, #extension, #name, #template_extension
Instance Method Summary collapse
- #after_action(controller) ⇒ Object
-
#initialize ⇒ RSSFormat
constructor
A new instance of RSSFormat.
Methods inherited from Format
#before_action, #filter_template, #to_s
Constructor Details
#initialize ⇒ RSSFormat
Returns a new instance of RSSFormat.
9 10 11 12 13 14 |
# File 'lib/raw/dispatcher/format/rss.rb', line 9 def initialize @name = "rss" @content_type = "text/xml" @extension = "xml" @template_extension = "xmlx" end |
Instance Method Details
#after_action(controller) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/raw/dispatcher/format/rss.rb', line 16 def after_action(controller) =begin if controller.out.blank? if model = controller.class.ann(:self, :model) resource = model.to_s.demodulize.underscore if collection = controller.instance_variable_get("@#{resource.plural}") controller.send(:print, XOXO.dump(collection)) elsif resource = controller.instance_variable_get("@#{resource}") controller.send(:print, XOXO.dump(resource)) end end end =end end |