class JobEngine::Position

Attributes

company[R]
company_url[R]
location[R]
path[R]
source_path[R]
source_url[R]
title[R]
type[R]
updated_at[R]

Public Class Methods

new(data) click to toggle source
# File lib/job_engine/position.rb, line 12
def initialize(data)
  @featured = data[:featured]

  @path = data[:path]
  @source_path = data[:source_path]
  @updated_at = data[:updated_at]
  @source_url = data[:source_url]
  @title = data[:title]
  @type = data[:type]
  @company = data[:company]
  @company_url = data[:company_url]
  @location = data[:location]
end
null() click to toggle source
# File lib/job_engine/position.rb, line 6
def self.null
  OpenStruct.new
end

Public Instance Methods

absolute_path() click to toggle source
# File lib/job_engine/position.rb, line 42
def absolute_path
  "/#@path"
end
atom_title()
Alias for: page_title
guid() click to toggle source
# File lib/job_engine/position.rb, line 26
def guid
  @guid ||= File.basename(path).split('.').first
end
has_source_url?() click to toggle source
# File lib/job_engine/position.rb, line 46
def has_source_url?
  !!@source_url
end
page_title() click to toggle source
# File lib/job_engine/position.rb, line 30
def page_title
  if title && company
    "#{title} at #{company}"
  end
end
Also aliased as: atom_title
source_hostname() click to toggle source
# File lib/job_engine/position.rb, line 50
def source_hostname
  if has_source_url?
    uri = URI.parse(@source_url)
    uri.hostname
  end
end