Class: ActionView::Helpers::AtomFeedHelper::AtomBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/action_view/helpers/atom_feed_helper.rb

Overview

:nodoc:

Direct Known Subclasses

AtomFeedBuilder

Constant Summary collapse

XHTML_TAG_NAMES =
%w(content rights title subtitle summary).to_set

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ AtomBuilder

Returns a new instance of AtomBuilder.



130
131
132
# File '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) ⇒ Object (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.



138
139
140
141
142
143
144
145
146
147
148
# 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