class LawSchoolOutcomes::EmploymentLocationSection

Constants

FOREIGN_TYPE
LOCATION_TYPES
STATE_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_status_section.rb, line 14
def initialize(report)
  super({
    :report => report,
    :header_content => "EMPLOYMENT LOCATION",
    :number_of_lines => LOCATION_TYPES.count + 1 # includes header line
  })
end

Public Instance Methods

results() click to toggle source
# File lib/law_school_outcomes/employment_summary_report/sections/employment_status_section.rb, line 22
def results
  counts = []

  STATE_TYPES.each do |state_type|
    line = lines.find{|line| line.include?(state_type) }
    state_and_count = line.gsub(state_type,"").strip.split("    ").select{|str| !str.empty?}.map{|str| str.strip }
    counts << {type: state_type, location: state_and_count.first, count: state_and_count.last}
  end

  foreign_line = lines.find{|line| line.include?(FOREIGN_TYPE) }
  foreign_count = last_number(foreign_line)
  counts << {type: FOREIGN_TYPE, location: FOREIGN_TYPE, count: foreign_count}

  return counts
end