Class: XMLObject::Adapters::Hpricot::Element
- Inherits:
-
Base::Element
- Object
- Base::Element
- XMLObject::Adapters::Hpricot::Element
- Defined in:
- lib/xml-object/adapters/hpricot.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from Base::Element
#attributes, #children, #name, #raw, #value
Instance Method Summary collapse
-
#initialize(xml) ⇒ Element
constructor
A new instance of Element.
Constructor Details
#initialize(xml) ⇒ Element
Returns a new instance of Element.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/xml-object/adapters/hpricot.rb', line 21 def initialize(xml) @raw, @name, @attributes = xml, xml.name, xml.attributes @element_nodes = xml.children.select { |c| c.elem? } @text_nodes = xml.children.select do |c| c.text? && !c.is_a?(::Hpricot::CData) end.map { |c| c.to_s } @cdata_nodes = xml.children.select do |c| c.is_a? ::Hpricot::CData end.map { |c| c.to_s } super end |