Class: ArticleFixtureGen::Data::BuildFragmentList
- Inherits:
-
Object
- Object
- ArticleFixtureGen::Data::BuildFragmentList
- Defined in:
- lib/article_fixture_gen/data/build_fragment_list.rb
Overview
Assembles a “fragment list”, a list of objects associating a string as found in a DOM leaf text node with the DOM position of that leaf node relative to a specified parent node and initial position. The default initial position, ‘[]`, indicates that the parent node is the root node of a DOM tree known to the caller.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.call(parent_node:, position: []) ⇒ Object
13 14 15 |
# File 'lib/article_fixture_gen/data/build_fragment_list.rb', line 13 def self.call(parent_node:, position: []) BuildFragmentList.new.call(parent_node, position) end |
Instance Method Details
#call(parent_node, position) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/article_fixture_gen/data/build_fragment_list.rb', line 17 def call(parent_node, position) ret = [] Internals.with_each_child_of(parent_node) do |node, index| ret += add_items_for(node, index, position) end ret end |