class ActionView::Helpers::AtomFeedHelper::AtomBuilder

Constants

XHTML_TAG_NAMES

Public Class Methods

new(xml) click to toggle source
# File lib/action_view/helpers/atom_feed_helper.rb, line 130
def initialize(xml)
  @xml = xml
end

Private Instance Methods

method_missing(method, *arguments, &block) click to toggle source

Delegate to xml builder, first wrapping the element in a xhtml namespaced div element if the method and arguments indicate that an xhtml_block? is desired.

# File 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
xhtml_block?(method, arguments) click to toggle source

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 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