module ArticleFixtureGen::Data::BuildFragmentList::Internals

Stateless methods.

Public Class Methods

item_with(position, string) click to toggle source
# File lib/article_fixture_gen/data/build_fragment_list.rb, line 35
def self.item_with(position, string)
  Array(FragmentPosition.new(position: position, string: string))
end
node?(item) click to toggle source

Reek doesn't like .respond_to?; it flags :reek:ManualDispatch. Tough.

# File lib/article_fixture_gen/data/build_fragment_list.rb, line 40
def self.node?(item)
  item.respond_to?(:nodes)
end
position_with(position, index) click to toggle source
# File lib/article_fixture_gen/data/build_fragment_list.rb, line 44
def self.position_with(position, index)
  position + Array(index)
end
with_each_child_of(parent_node) { |node, index| ... } click to toggle source

This is here because we need both the node and the index, so `Array#map` doesn't do us for.

# File lib/article_fixture_gen/data/build_fragment_list.rb, line 50
def self.with_each_child_of(parent_node)
  parent_node.nodes.each_with_index { |node, index| yield(node, index) }
end