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

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

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.



128
129
130
# File 'lib/action_view/helpers/atom_feed_helper.rb', line 128

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 a xhtml namespaced div element if the method and arguments indicate that an xhtml_block? is desired.



136
137
138
139
140
141
142
143
144
145
146
# File 'lib/action_view/helpers/atom_feed_helper.rb', line 136

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