Class: XMLObject::Adapters::Base::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/xml-object/adapters.rb

Overview

:nodoc:

Direct Known Subclasses

Hpricot::Element, LibXML::Element, REXML::Element

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Element

Returns a new instance of Element.



7
8
9
10
11
12
13
14
15
16
# File 'lib/xml-object/adapters.rb', line 7

def initialize(*args)

  @children = @element_nodes.map { |node| self.class.new(node) }

  @value = case
    when (not text_value.blank?)  then text_value
    when (not cdata_value.blank?) then cdata_value
    else ''
  end
end

Instance Attribute Details

#attributesObject

:nodoc:



5
6
7
# File 'lib/xml-object/adapters.rb', line 5

def attributes
  @attributes
end

#childrenObject

:nodoc:



5
6
7
# File 'lib/xml-object/adapters.rb', line 5

def children
  @children
end

#nameObject

:nodoc:



5
6
7
# File 'lib/xml-object/adapters.rb', line 5

def name
  @name
end

#rawObject

:nodoc:



5
6
7
# File 'lib/xml-object/adapters.rb', line 5

def raw
  @raw
end

#valueObject

:nodoc:



5
6
7
# File 'lib/xml-object/adapters.rb', line 5

def value
  @value
end