class LawSchoolOutcomes::EmploymentTypeSection
Constants
- EMPLOYMENT_TYPES
- LAW_FIRM_SIZES
- NON_LAW_FIRM_TYPES
Public Class Methods
new(report)
click to toggle source
Calls superclass method
LawSchoolOutcomes::Section::new
# File lib/law_school_outcomes/employment_summary_report/sections/employment_type_section.rb, line 21 def initialize(report) super({ :report => report, :header_content => "EMPLOYMENT TYPE", :number_of_lines => EMPLOYMENT_TYPES.count + LAW_FIRM_SIZES.count + 1 + 1 }) end
Public Instance Methods
results()
click to toggle source
# File lib/law_school_outcomes/employment_summary_report/sections/employment_type_section.rb, line 29 def results counts = [] LAW_FIRM_SIZES.each do |size| line = lines.find{|line| line.include?(size) } number = last_number(line) counts << {type: "Law Firms (#{size})", count: number} end NON_LAW_FIRM_TYPES.each do |type| line = lines.find{|line| line.include?(type) } number = last_number(line) counts << {type: type, count: number} end total_employed_graduates = last_number(lines.last) calculated_total_employed_graduates = counts.map{|h| h[:count] }.reduce{|sum, x| sum + x} raise EmployedGraduatesTotalsError if total_employed_graduates != calculated_total_employed_graduates return counts end