Class: ActionView::Helpers::AtomFeedHelper::AtomFeedBuilder
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
AtomBuilder
|
|
|
Instance Chain:
self,
AtomBuilder
|
|
| Inherits: |
ActionView::Helpers::AtomFeedHelper::AtomBuilder
|
| Defined in: | actionview/lib/action_view/helpers/atom_feed_helper.rb |
Constant Summary
AtomBuilder - Inherited
Class Method Summary
Instance Method Summary
-
#entry(record, options = {})
Creates an entry tag for a specific record and prefills the id using class and id.
- #updated(date_or_time = nil)
AtomBuilder - Inherited
| #method_missing | Delegate to XML Builder, first wrapping the element in an XHTML namespaced div element if the method and arguments indicate that an xhtml_block? is desired. |
| #xhtml_block? | True if the method name matches one of the five elements defined in the Atom spec as potentially containing XHTML content and if type: ‘xhtml’ is, in fact, specified. |
Constructor Details
.new(xml, view, feed_options = {}) ⇒ AtomFeedBuilder
# File 'actionview/lib/action_view/helpers/atom_feed_helper.rb', line 162
def initialize(xml, view, = {}) @xml, @view, @feed_options = xml, view, end
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActionView::Helpers::AtomFeedHelper::AtomBuilder
Instance Method Details
#entry(record, options = {})
Creates an entry tag for a specific record and prefills the id using class and id.
Options
-
:published:::Timefirst published. Defaults to the created_at attribute on the record if one such exists. -
:updated:::Timeof update. Defaults to the updated_at attribute on the record if one such exists. -
:url: The URL for this entry orfalseornilfor not having a link tag. Defaults to thepolymorphic_urlfor the record. -
:id: The ID for this entry. Defaults to “tag:#@view.request.host,#href=":schema_date">feed_options:#record.class/#record.id” -
:type: The TYPE for this entry. Defaults to “text/html”.
# File 'actionview/lib/action_view/helpers/atom_feed_helper.rb', line 180
def entry(record, = {}) @xml.entry do @xml.id([:id] || "tag:#{@view.request.host},#{@feed_options[:schema_date]}:#{record.class}/#{record.id}") if [:published] || (record.respond_to?(:created_at) && record.created_at) @xml.published(([:published] || record.created_at).xmlschema) end if [:updated] || (record.respond_to?(:updated_at) && record.updated_at) @xml.updated(([:updated] || record.updated_at).xmlschema) end type = .fetch(:type, "text/html") url = .fetch(:url) { @view.polymorphic_url(record) } @xml.link(rel: "alternate", type: type, href: url) if url yield AtomBuilder.new(@xml) end end
#updated(date_or_time = nil)
# File 'actionview/lib/action_view/helpers/atom_feed_helper.rb', line 167
def updated(date_or_time = nil) @xml.updated((date_or_time || Time.now.utc).xmlschema) end