| Class | ActionView::Helpers::AtomFeedHelper::AtomFeedBuilder |
| In: |
vendor/rails/actionpack/lib/action_view/helpers/atom_feed_helper.rb
|
| Parent: | AtomBuilder |
# File vendor/rails/actionpack/lib/action_view/helpers/atom_feed_helper.rb, line 160
160: def initialize(xml, view, feed_options = {})
161: @xml, @view, @feed_options = xml, view, feed_options
162: 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 177
177: def entry(record, options = {})
178: @xml.entry do
179: @xml.id(options[:id] || "tag:#{@view.request.host},#{@feed_options[:schema_date]}:#{record.class}/#{record.id}")
180:
181: if options[:published] || (record.respond_to?(:created_at) && record.created_at)
182: @xml.published((options[:published] || record.created_at).xmlschema)
183: end
184:
185: if options[:updated] || (record.respond_to?(:updated_at) && record.updated_at)
186: @xml.updated((options[:updated] || record.updated_at).xmlschema)
187: end
188:
189: @xml.link(:rel => 'alternate', :type => 'text/html', :href => options[:url] || @view.polymorphic_url(record))
190:
191: yield AtomBuilder.new(@xml)
192: end
193: 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 165
165: def updated(date_or_time = nil)
166: @xml.updated((date_or_time || Time.now.utc).xmlschema)
167: end