Class: ActionView::Helpers::AtomFeedHelper::AtomBuilder
Do not use. This class is for internal use only.
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
|
|
Inherits: | Object |
Defined in: | actionview/lib/action_view/helpers/atom_feed_helper.rb |
Constant Summary
-
XHTML_TAG_NAMES =
# File 'actionview/lib/action_view/helpers/atom_feed_helper.rb', line 128%w(content rights title subtitle summary).to_set
Class Method Summary
- .new(xml) ⇒ AtomBuilder constructor
Instance Method Summary
-
#method_missing(method, *arguments, &block)
private
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?(method, arguments) ⇒ Boolean
private
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) ⇒ AtomBuilder
# File 'actionview/lib/action_view/helpers/atom_feed_helper.rb', line 130
def initialize(xml) @xml = xml end
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *arguments, &block) (private)
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.
# File 'actionview/lib/action_view/helpers/atom_feed_helper.rb', line 138
def method_missing(method, *arguments, &block) if xhtml_block?(method, arguments) @xml.__send__(method, *arguments) do @xml.div(xmlns: "http://www.w3.org/1999/xhtml") do |xhtml| block.call(xhtml) end end else @xml.__send__(method, *arguments, &block) end end
Instance Method Details
#xhtml_block?(method, arguments) ⇒ Boolean
(private)
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.
# File 'actionview/lib/action_view/helpers/atom_feed_helper.rb', line 153
def xhtml_block?(method, arguments) if XHTML_TAG_NAMES.include?(method.to_s) last = arguments.last last.is_a?(Hash) && last[:type].to_s == "xhtml" end end