class ArticleFixtureGen::Data::PmtpAttributes

Wraps attributes for a single marker-tag pair instance. Initially, the only attribute supported is `:id_string`.

Attributes

items[R]

Public Class Methods

new(config:) click to toggle source
# File lib/article_fixture_gen/data/pmtp_attributes.rb, line 10
def initialize(config:)
  @items = build_all_items(config.pmtp_count, config.pmtp_text)
  self
end

Public Instance Methods

each() { |item| ... } click to toggle source
# File lib/article_fixture_gen/data/pmtp_attributes.rb, line 15
def each(&_block)
  @items.each { |item| yield item }
end

Private Instance Methods

build_all_items(count, text) click to toggle source
# File lib/article_fixture_gen/data/pmtp_attributes.rb, line 23
def build_all_items(count, text)
  Array.new(count) { build_items(text) }.flatten
end
build_items(text, rand_limit: 10_000) click to toggle source
# File lib/article_fixture_gen/data/pmtp_attributes.rb, line 27
def build_items(text, rand_limit: 10_000)
  id_num = rand(rand_limit) + 1
  begin_item = Internals.build_item(text, id_num, 'begin')
  end_item = Internals.build_item(text, id_num, 'end')
  [end_item, begin_item]
end