Class: Mapricot::AbstractNode
- Inherits:
-
Object
- Object
- Mapricot::AbstractNode
- Defined in:
- lib/mapricot/abstract_doc.rb
Instance Attribute Summary collapse
-
#unode ⇒ Object
readonly
Returns the value of attribute unode.
Instance Method Summary collapse
- #attributes ⇒ Object
- #contents ⇒ Object
-
#initialize(unode) ⇒ AbstractNode
constructor
A new instance of AbstractNode.
- #to_s ⇒ Object
Constructor Details
#initialize(unode) ⇒ AbstractNode
Returns a new instance of AbstractNode.
71 72 73 |
# File 'lib/mapricot/abstract_doc.rb', line 71 def initialize(unode) @unode = unode # unresolved node end |
Instance Attribute Details
#unode ⇒ Object (readonly)
Returns the value of attribute unode.
69 70 71 |
# File 'lib/mapricot/abstract_doc.rb', line 69 def unode @unode end |
Instance Method Details
#attributes ⇒ Object
79 80 81 82 83 84 85 86 87 |
# File 'lib/mapricot/abstract_doc.rb', line 79 def attributes if Mapricot.parser != :nokogiri @unode.attributes else atts = {} @unode.attributes.each {|k,v| atts[k] = v.value} atts end end |
#contents ⇒ Object
89 90 91 92 93 94 95 |
# File 'lib/mapricot/abstract_doc.rb', line 89 def contents if Mapricot.parser == :libxml || Mapricot.parser == :nokogiri @unode.content else @unode.inner_html end end |
#to_s ⇒ Object
75 76 77 |
# File 'lib/mapricot/abstract_doc.rb', line 75 def to_s @unode.to_s end |