Class: ArticleFixtureGen::Data::SplitTextAtTargetWord

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

Overview

Produces an array of two strings such that, for a specified text node (string), the first string will be the text before a specified word, and the second (last) string will be the text after that word. The word in question is specified by a child-node index relative to the ‘el` parameter (an `Ox::Element` instance) and a word index within that child node.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(el, target_entry) ⇒ Object



11
12
13
# File 'lib/article_fixture_gen/data/split_text_at_target_word.rb', line 11

def self.call(el, target_entry)
  new(el, target_entry).call
end

Instance Method Details

#callObject



15
16
17
# File 'lib/article_fixture_gen/data/split_text_at_target_word.rb', line 15

def call
  [head, tail]
end