Class: ArticleFixtureGen::Data::BuildWordList

Inherits:
Object
  • Object
show all
Defined in:
lib/article_fixture_gen/data/build_word_list.rb

Overview

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.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(parent_node:, dom_position: []) ⇒ Object



69
70
71
# 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

Instance Method Details

#callObject



73
74
75
76
77
78
# 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