Class: Clef::Layout::PageBreaker

Inherits:
Object
  • Object
show all
Defined in:
lib/clef/layout/page_breaker.rb

Instance Method Summary collapse

Instance Method Details

#break_into_pages(lines, page_height:, line_height:) ⇒ Array<Array<Array<Hash>>>

Parameters:

  • lines (Array<Array<Hash>>)
  • page_height (Float)
  • line_height (Float)

Returns:

  • (Array<Array<Array<Hash>>>)


10
11
12
13
# File 'lib/clef/layout/page_breaker.rb', line 10

def break_into_pages(lines, page_height:, line_height:)
  max_lines = [(page_height / line_height).floor, 1].max
  lines.each_slice(max_lines).to_a
end