Class: Job

Inherits:
Object
  • Object
show all
Defined in:
lib/indeed_scraper/job.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job_hash) ⇒ Job

Returns a new instance of Job.



6
7
8
9
# File 'lib/indeed_scraper/job.rb', line 6

def initialize(job_hash)
  job_hash.each {|key, value| self.send(("#{key}="), value)}
  @@all << self
end

Instance Attribute Details

#companyObject

Returns the value of attribute company.



2
3
4
# File 'lib/indeed_scraper/job.rb', line 2

def company
  @company
end

#descriptionObject

Returns the value of attribute description.



2
3
4
# File 'lib/indeed_scraper/job.rb', line 2

def description
  @description
end

#job_urlObject

Returns the value of attribute job_url.



2
3
4
# File 'lib/indeed_scraper/job.rb', line 2

def job_url
  @job_url
end

#locationObject

Returns the value of attribute location.



2
3
4
# File 'lib/indeed_scraper/job.rb', line 2

def location
  @location
end

#salaryObject

Returns the value of attribute salary.



2
3
4
# File 'lib/indeed_scraper/job.rb', line 2

def salary
  @salary
end

#titleObject

Returns the value of attribute title.



2
3
4
# File 'lib/indeed_scraper/job.rb', line 2

def title
  @title
end

Class Method Details

.allObject



18
19
20
# File 'lib/indeed_scraper/job.rb', line 18

def self.all
  @@all
end

.clear_allObject



22
23
24
# File 'lib/indeed_scraper/job.rb', line 22

def self.clear_all
  @@all.clear
end

.create_from_collection(jobs_array) ⇒ Object



11
12
13
14
15
16
# File 'lib/indeed_scraper/job.rb', line 11

def self.create_from_collection(jobs_array)
  jobs_array.each do |hash|
    new_job = self.new(hash)
    new_job
  end
end