Sha256: 5a37a82df49fb6ebb649937f3a6cfcbc9caa460ffaeabe1b25e799f05eeac370
Contents?: true
Size: 985 Bytes
Versions: 94
Compression:
Stored size: 985 Bytes
Contents
class Career HEADING_TAG_LIST = %w[h1 h2 h3 h4 h5 h6].freeze DEPARTMENTS = YAML.safe_load(File.read("#{Rails.configuration.docs_base_path}/config/greenhouse_departments.yml")) def initialize(career) @career = career end def title @career[:title] end def location @career.dig(:location, :name) end def department_codes @department_codes ||= @career[:departments].pluck(:id) # rubocop:disable Rails/PluckId end def description content = CGI.unescapeHTML(@career[:content]) # If it starts with a header, strip it out document = Nokogiri::HTML::DocumentFragment.parse(content) first_child = document.children[0] first_child.remove if HEADING_TAG_LIST.include?(first_child.name) document.to_html end def url @career[:absolute_url] end def devrel? @career[:departments].any? { |d| d[:id] == Greenhouse::DEPARTMENT_ID } && @career[:title].downcase.match?(Regexp.union(Greenhouse::TITLES)) end end
Version data entries
94 entries across 94 versions & 1 rubygems