Method: REXML::Element#document
- Defined in:
- lib/rexml/element.rb
#document ⇒ Object
:call-seq:
document -> document or nil
If the element is part of a document, returns that document:
d = REXML::Document.new('<a><b><c/></b></a>')
top_element = d.first
child = top_element.first
top_element.document == d # => true
child.document == d # => true
If the element is not part of a document, returns nil:
REXML::Element.new.document # => nil
For a document, returns self:
d.document == d # => true
Related: #root, #root_node.
475 476 477 |
# File 'lib/rexml/element.rb', line 475 def document root&.parent end |