Module: XMLObject::Element

Defined in:
lib/xml-object/element.rb

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *a, &b) ⇒ Object (private)

:nodoc:



18
19
20
21
22
23
# File 'lib/xml-object/element.rb', line 18

def method_missing(m, *a, &b) # :nodoc:
  dispatched = __question_dispatch(m, *a, &b)
  dispatched = __dot_notation_dispatch(m, *a, &b) if dispatched.nil?

  dispatched.nil? ? raise(NameError.new(m.to_s)) : dispatched
end

Class Method Details

.new(xml) ⇒ Object

:nodoc:



2
3
4
5
6
7
8
# File 'lib/xml-object/element.rb', line 2

def self.new(xml) # :nodoc:
  element = xml.value
  element.instance_variable_set :@__raw_xml,    xml.raw
  element.instance_variable_set :@__children,   {}
  element.instance_variable_set :@__attributes, {}
  element.extend self
end

Instance Method Details

#raw_xmlObject

The raw, unadapted XML object. Whatever this is, it really depends on the currently chosen adapter.



12
13
14
# File 'lib/xml-object/element.rb', line 12

def raw_xml
  @__raw_xml
end