Class: REXML::Element
- Inherits:
-
Object
- Object
- REXML::Element
- Defined in:
- lib/html/rexml-nodepath.rb
Instance Method Summary collapse
Instance Method Details
#child_index ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/html/rexml-nodepath.rb', line 24 def child_index return "" unless parent siblings = parent.to_a.select do |node| node.kind_of? Element and node. == self. end return "" if siblings.size < 2 "[" + (siblings.index(self)+1).to_s + "]" end |
#full_path ⇒ Object
33 34 35 |
# File 'lib/html/rexml-nodepath.rb', line 33 def full_path parent_path + '/' + + child_index end |