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

Version Path
station-0.5.16 lib/nexmo_developer/app/presenters/career.rb
station-0.5.15 lib/nexmo_developer/app/presenters/career.rb
station-0.5.14 lib/nexmo_developer/app/presenters/career.rb
station-0.5.13 lib/nexmo_developer/app/presenters/career.rb
station-0.5.12 lib/nexmo_developer/app/presenters/career.rb
station-0.5.11 lib/nexmo_developer/app/presenters/career.rb
station-0.5.10 lib/nexmo_developer/app/presenters/career.rb
station-0.5.9 lib/nexmo_developer/app/presenters/career.rb
station-0.5.8 lib/nexmo_developer/app/presenters/career.rb
station-0.5.7 lib/nexmo_developer/app/presenters/career.rb
station-0.5.6 lib/nexmo_developer/app/presenters/career.rb
station-0.5.5 lib/nexmo_developer/app/presenters/career.rb
station-0.5.4 lib/nexmo_developer/app/presenters/career.rb
station-0.5.3 lib/nexmo_developer/app/presenters/career.rb
station-0.5.2 lib/nexmo_developer/app/presenters/career.rb
station-0.5.1 lib/nexmo_developer/app/presenters/career.rb
station-0.5.0 lib/nexmo_developer/app/presenters/career.rb
station-0.4.9 lib/nexmo_developer/app/presenters/career.rb
station-0.4.8 lib/nexmo_developer/app/presenters/career.rb
station-0.4.7 lib/nexmo_developer/app/presenters/career.rb