Class: ArticleFixtureGen::Data::ParentElementFor
- Inherits:
-
Object
- Object
- ArticleFixtureGen::Data::ParentElementFor
- Defined in:
- lib/article_fixture_gen/data/parent_element_for.rb
Overview
Given a parent element and an array of integers which fully specify the DOM position of a node (or element, really), walk the DOM from the given parent to find the element which contains a node at the specified point below that parent. This is to work around the fact that Ox maintains no links between a node (or element) with its parent.
Class Method Summary collapse
Class Method Details
.call(parent, dom_pos_indexes) ⇒ Object
11 12 13 14 15 |
# File 'lib/article_fixture_gen/data/parent_element_for.rb', line 11 def self.call(parent, dom_pos_indexes) el = parent dom_pos_indexes[0..-2].each { |index| el = el.nodes[index] } el end |