Class: LawSchoolOutcomes::Section
- Inherits:
-
Object
- Object
- LawSchoolOutcomes::Section
- Defined in:
- lib/law_school_outcomes/employment_summary_report/section.rb
Direct Known Subclasses
EmploymentLocationSection, EmploymentStatusSection, EmploymentTypeSection
Instance Attribute Summary collapse
-
#header_content ⇒ Object
readonly
Returns the value of attribute header_content.
-
#number_of_lines ⇒ Object
readonly
Returns the value of attribute number_of_lines.
-
#report ⇒ Object
readonly
Returns the value of attribute report.
Instance Method Summary collapse
- #first_line_index ⇒ Object
-
#initialize(report:, header_content:, number_of_lines:) ⇒ Section
constructor
A new instance of Section.
- #last_line_index ⇒ Object
- #lines ⇒ Object
Constructor Details
#initialize(report:, header_content:, number_of_lines:) ⇒ Section
Returns a new instance of Section.
5 6 7 8 9 |
# 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 |
Instance Attribute Details
#header_content ⇒ Object (readonly)
Returns the value of attribute header_content.
3 4 5 |
# File 'lib/law_school_outcomes/employment_summary_report/section.rb', line 3 def header_content @header_content end |
#number_of_lines ⇒ Object (readonly)
Returns the value of attribute number_of_lines.
3 4 5 |
# File 'lib/law_school_outcomes/employment_summary_report/section.rb', line 3 def number_of_lines @number_of_lines end |
#report ⇒ Object (readonly)
Returns the value of attribute report.
3 4 5 |
# File 'lib/law_school_outcomes/employment_summary_report/section.rb', line 3 def report @report end |
Instance Method Details
#first_line_index ⇒ Object
11 12 13 |
# 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 ⇒ Object
15 16 17 |
# File 'lib/law_school_outcomes/employment_summary_report/section.rb', line 15 def last_line_index first_line_index + number_of_lines end |
#lines ⇒ Object
19 20 21 |
# File 'lib/law_school_outcomes/employment_summary_report/section.rb', line 19 def lines report.lines[first_line_index .. last_line_index] end |