class ArticleFixtureGen::Data::BuildWordList

Builds an array of WordEntry items, associating fragments of DOM text leaf nodes with position information of their containing node within the DOM and of the fragment within a (whitespace-split) array of fragments within the containing DOM node's text.

Attributes

dom_position[R]
parent_node[R]

Public Class Methods

call(parent_node:, dom_position: []) click to toggle source
# File lib/article_fixture_gen/data/build_word_list.rb, line 69
def self.call(parent_node:, dom_position: [])
  BuildWordList.new(parent_node, dom_position).call
end
new(parent_node, dom_position) click to toggle source
# File lib/article_fixture_gen/data/build_word_list.rb, line 82
def initialize(parent_node, dom_position)
  @dom_position = dom_position
  @parent_node = parent_node
  self
end

Public Instance Methods

call() click to toggle source
# File lib/article_fixture_gen/data/build_word_list.rb, line 73
def call
  ret = string_items.map do |string_item|
    Internals.entries_for string_item
  end
  ret.flatten
end

Private Instance Methods

string_items() click to toggle source
# File lib/article_fixture_gen/data/build_word_list.rb, line 92
def string_items
  BuildFragmentList.call(parent_node: parent_node, position: dom_position)
end