class LawSchoolOutcomes::Section

Attributes

header_content[R]
number_of_lines[R]
report[R]

Public Class Methods

new(report:, header_content:, number_of_lines:) click to toggle source
# File lib/law_school_outcomes/employment_summary_report/section.rb, line 5
def initialize(report:, header_content:, number_of_lines:)
  @report = report
  @header_content = header_content
  @number_of_lines = number_of_lines
end

Public Instance Methods

first_line_index() click to toggle source
# File lib/law_school_outcomes/employment_summary_report/section.rb, line 11
def first_line_index
  report.lines.each_with_index.find{|line, i| line.include?(header_content)}.last
end
last_line_index() click to toggle source
# File lib/law_school_outcomes/employment_summary_report/section.rb, line 15
def last_line_index
  first_line_index + number_of_lines
end
lines() click to toggle source
# File lib/law_school_outcomes/employment_summary_report/section.rb, line 19
def lines
  report.lines[first_line_index .. last_line_index]
end

Private Instance Methods

last_number(line) click to toggle source

@param [String] line e.g. “New York 34”

# File lib/law_school_outcomes/employment_summary_report/section.rb, line 26
def last_number(line)
  line.split(" ").last.to_i
end