class PDF::Reader::PageLayout
def interesting_rows(rows)
=> [ "one", "two" ]
interesting_rows([ "", "one", "two", "" ])
beginning and end removed.
given an array of strings, return a new array with empty rows from the
def interesting_rows(rows) line_lengths = rows.map { |l| l.strip.length } return [] if line_lengths.all?(&:zero?) first_line_with_text = line_lengths.index { |l| l > 0 } last_line_with_text = line_lengths.size - line_lengths.reverse.index { |l| l > 0 } interesting_line_count = last_line_with_text - first_line_with_text rows[first_line_with_text, interesting_line_count].map end