Class: JobEngine::Position
- Inherits:
-
Object
- Object
- JobEngine::Position
- Defined in:
- lib/job_engine/position.rb
Instance Attribute Summary collapse
-
#company ⇒ Object
readonly
Returns the value of attribute company.
-
#company_url ⇒ Object
readonly
Returns the value of attribute company_url.
-
#featured ⇒ Object
readonly
Returns the value of attribute featured.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#source_path ⇒ Object
readonly
Returns the value of attribute source_path.
-
#source_url ⇒ Object
readonly
Returns the value of attribute source_url.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Class Method Summary collapse
Instance Method Summary collapse
- #absolute_path ⇒ Object
- #featured? ⇒ Boolean
- #guid ⇒ Object
- #has_source_url? ⇒ Boolean
-
#initialize(data) ⇒ Position
constructor
A new instance of Position.
- #page_title ⇒ Object (also: #atom_title)
- #source_hostname ⇒ Object
Constructor Details
#initialize(data) ⇒ Position
Returns a new instance of Position.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# 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 |
Instance Attribute Details
#company ⇒ Object (readonly)
Returns the value of attribute company.
10 11 12 |
# File 'lib/job_engine/position.rb', line 10 def company @company end |
#company_url ⇒ Object (readonly)
Returns the value of attribute company_url.
10 11 12 |
# File 'lib/job_engine/position.rb', line 10 def company_url @company_url end |
#featured ⇒ Object (readonly)
Returns the value of attribute featured.
10 11 12 |
# File 'lib/job_engine/position.rb', line 10 def featured @featured end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
10 11 12 |
# File 'lib/job_engine/position.rb', line 10 def location @location end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
10 11 12 |
# File 'lib/job_engine/position.rb', line 10 def path @path end |
#source_path ⇒ Object (readonly)
Returns the value of attribute source_path.
10 11 12 |
# File 'lib/job_engine/position.rb', line 10 def source_path @source_path end |
#source_url ⇒ Object (readonly)
Returns the value of attribute source_url.
10 11 12 |
# File 'lib/job_engine/position.rb', line 10 def source_url @source_url end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
10 11 12 |
# File 'lib/job_engine/position.rb', line 10 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
10 11 12 |
# File 'lib/job_engine/position.rb', line 10 def type @type end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
10 11 12 |
# File 'lib/job_engine/position.rb', line 10 def updated_at @updated_at end |
Class Method Details
.null ⇒ Object
6 7 8 |
# File 'lib/job_engine/position.rb', line 6 def self.null OpenStruct.new end |
Instance Method Details
#absolute_path ⇒ Object
42 43 44 |
# File 'lib/job_engine/position.rb', line 42 def absolute_path "/#@path" end |
#featured? ⇒ Boolean
38 39 40 |
# File 'lib/job_engine/position.rb', line 38 def featured? !!@featured end |
#guid ⇒ Object
26 27 28 |
# File 'lib/job_engine/position.rb', line 26 def guid @guid ||= File.basename(path).split('.').first end |
#has_source_url? ⇒ Boolean
46 47 48 |
# File 'lib/job_engine/position.rb', line 46 def has_source_url? !!@source_url end |
#page_title ⇒ Object Also known as: atom_title
30 31 32 33 34 |
# File 'lib/job_engine/position.rb', line 30 def page_title if title && company "#{title} at #{company}" end end |
#source_hostname ⇒ Object
50 51 52 53 54 55 |
# File 'lib/job_engine/position.rb', line 50 def source_hostname if has_source_url? uri = URI.parse(@source_url) uri.hostname end end |