| Class | ActionView::Helpers::AtomFeedHelper::AtomFeedBuilder |
| In: |
vendor/rails/actionpack/lib/action_view/helpers/atom_feed_helper.rb
|
| Parent: | Object |
# File vendor/rails/actionpack/lib/action_view/helpers/atom_feed_helper.rb, line 102
102: def initialize(xml, view, feed_options = {})
103: @xml, @view, @feed_options = xml, view, feed_options
104: end
Creates an entry tag for a specific record and prefills the id using class and id.
Options:
# File vendor/rails/actionpack/lib/action_view/helpers/atom_feed_helper.rb, line 118
118: def entry(record, options = {})
119: @xml.entry do
120: @xml.id("tag:#{@view.request.host},#{@feed_options[:schema_date]}:#{record.class}/#{record.id}")
121:
122: if options[:published] || (record.respond_to?(:created_at) && record.created_at)
123: @xml.published((options[:published] || record.created_at).xmlschema)
124: end
125:
126: if options[:updated] || (record.respond_to?(:updated_at) && record.updated_at)
127: @xml.updated((options[:updated] || record.updated_at).xmlschema)
128: end
129:
130: @xml.link(:rel => 'alternate', :type => 'text/html', :href => options[:url] || @view.polymorphic_url(record))
131:
132: yield @xml
133: end
134: end
Accepts a Date or Time object and inserts it in the proper format. If nil is passed, current time in UTC is used.
# File vendor/rails/actionpack/lib/action_view/helpers/atom_feed_helper.rb, line 107
107: def updated(date_or_time = nil)
108: @xml.updated((date_or_time || Time.now.utc).xmlschema)
109: end