Class: RemoteDevJobs::CLI::Job
- Inherits:
-
Object
- Object
- RemoteDevJobs::CLI::Job
- Defined in:
- lib/remote_dev_jobs/Job.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#company ⇒ Object
Returns the value of attribute company.
-
#company_site ⇒ Object
Returns the value of attribute company_site.
-
#description ⇒ Object
Returns the value of attribute description.
-
#job_url ⇒ Object
Returns the value of attribute job_url.
-
#location ⇒ Object
Returns the value of attribute location.
-
#number ⇒ Object
Returns the value of attribute number.
-
#position ⇒ Object
Returns the value of attribute position.
-
#seniority ⇒ Object
Returns the value of attribute seniority.
Class Method Summary collapse
Instance Method Summary collapse
- #add_job_attributes(attributes_hash) ⇒ Object
-
#initialize(job_hash) ⇒ Job
constructor
A new instance of Job.
Constructor Details
#initialize(job_hash) ⇒ Job
7 8 9 10 11 12 |
# File 'lib/remote_dev_jobs/Job.rb', line 7 def initialize(job_hash) job_hash.each do |attr, value| self.send("#{attr}=", value) end @@all << self end |
Instance Attribute Details
#company ⇒ Object
Returns the value of attribute company.
3 4 5 |
# File 'lib/remote_dev_jobs/Job.rb', line 3 def company @company end |
#company_site ⇒ Object
Returns the value of attribute company_site.
3 4 5 |
# File 'lib/remote_dev_jobs/Job.rb', line 3 def company_site @company_site end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/remote_dev_jobs/Job.rb', line 3 def description @description end |
#job_url ⇒ Object
Returns the value of attribute job_url.
3 4 5 |
# File 'lib/remote_dev_jobs/Job.rb', line 3 def job_url @job_url end |
#location ⇒ Object
Returns the value of attribute location.
3 4 5 |
# File 'lib/remote_dev_jobs/Job.rb', line 3 def location @location end |
#number ⇒ Object
Returns the value of attribute number.
3 4 5 |
# File 'lib/remote_dev_jobs/Job.rb', line 3 def number @number end |
#position ⇒ Object
Returns the value of attribute position.
3 4 5 |
# File 'lib/remote_dev_jobs/Job.rb', line 3 def position @position end |
#seniority ⇒ Object
Returns the value of attribute seniority.
3 4 5 |
# File 'lib/remote_dev_jobs/Job.rb', line 3 def seniority @seniority end |
Class Method Details
.all ⇒ Object
36 37 38 |
# File 'lib/remote_dev_jobs/Job.rb', line 36 def self.all @@all end |
.create_from_collection(jobs_array) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/remote_dev_jobs/Job.rb', line 14 def self.create_from_collection(jobs_array) jobs_array.each_with_index do |job, index| if job job_hash = { number: index + 1, company: job[:company], location: job[:location], position: job[:position], seniority: job[:seniority], job_url: job[:job_url] } self.new(job_hash) end end end |
Instance Method Details
#add_job_attributes(attributes_hash) ⇒ Object
30 31 32 33 34 |
# File 'lib/remote_dev_jobs/Job.rb', line 30 def add_job_attributes(attributes_hash) attributes_hash.each do |attr, value| self.send("#{attr}=", value) end end |