Module: Rind::Xml

Defined in:
lib/rind/xml.rb

Overview

Rind::Xml will dynamically create any XML element.

Class Method Summary collapse

Class Method Details

.const_missing(full_class_name, options = {}) ⇒ Object

:nodoc:



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rind/xml.rb', line 4

def self.const_missing(full_class_name, options={}) # :nodoc:
	klass = Class.new(Element) do
	  # <b>Parent:</b> Element
		# === Example
		#  Rind::Xml::Foo.new(
		#    :attributes => {:id => "bar"},
		#    :children   => "Hello World!"
		#  )
		def initialize(options={})
			super(options)
		end

		def expanded_name # :nodoc:
			if @namespace_name.nil? or @namespace_name == '' or @namespace_name =~ /^(?:rind:)?xml/
				@local_name
			else
				[@namespace_name, @local_name].join(':')
			end
		end
	end
	const_set full_class_name, klass
	klass
end