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.



133
134
135
# File 'lib/action_view/helpers/atom_feed_helper.rb', line 133

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.



141
142
143
144
145
146
147
148
149
150
151
# File 'lib/action_view/helpers/atom_feed_helper.rb', line 141

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