| 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 70
70: def initialize(xml, view)
71: @xml, @view = xml, view
72: 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 86
86: def entry(record, options = {})
87: @xml.entry do
88: @xml.id("tag:#{@view.request.host_with_port}:#{record.class}#{record.id}")
89:
90: if options[:published] || (record.respond_to?(:created_at) && record.created_at)
91: @xml.published((options[:published] || record.created_at).xmlschema)
92: end
93:
94: if options[:updated] || (record.respond_to?(:updated_at) && record.updated_at)
95: @xml.updated((options[:updated] || record.updated_at).xmlschema)
96: end
97:
98: @xml.link(:rel => 'alternate', :type => 'text/html', :href => options[:url] || @view.polymorphic_url(record))
99:
100: yield @xml
101: end
102: 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 75
75: def updated(date_or_time = nil)
76: @xml.updated((date_or_time || Time.now.utc).xmlschema)
77: end