class BentleyMcIlroy::BlockSequencedText

A container for the original text we’re processing. Divides the text into Block objects.

Attributes

blocks[R]
text[R]

Public Class Methods

new(text, block_size) click to toggle source
# File lib/bentley_mcilroy.rb, line 24
def initialize(text, block_size)
  @text = text
  @block_size = block_size
  @blocks = []

  # "onetwothree" -> ["one", "two", "thr", "ee"]
  @text.scan(/.(?:.?){#{@block_size-1}}/).each.with_index do |text_block, index|
    @blocks << Block.new(text_block, index * @block_size)
  end
end