class DigitalNomadJobs::Job
Attributes
company[RW]
description[RW]
job_url[RW]
skills[RW]
time_posted[RW]
title[RW]
Public Class Methods
all()
click to toggle source
# File lib/digital_nomad_jobs/job.rb, line 24 def self.all @@all end
create_from_collection(array)
click to toggle source
# File lib/digital_nomad_jobs/job.rb, line 14 def self.create_from_collection(array) array.each do | hash | job = new(hash) end end
list_all_jobs()
click to toggle source
# File lib/digital_nomad_jobs/job.rb, line 32 def self.list_all_jobs all.each.with_index(1) do | job, i | puts "-----------------------------------------------------------------------------------------------".blue puts "#{i}. #{job.title} - #{job.company} - Posted:#{job.time_posted} Ago" puts "-----------------------------------------------------------------------------------------------".blue puts "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX".blue end end
new(attributes)
click to toggle source
# File lib/digital_nomad_jobs/job.rb, line 6 def initialize(attributes) attributes.each {|key, value| self.send(("#{key}="), value) unless key == :company_url} @@all << self company = DigitalNomadJobs::Company.find_or_create_by_name(self.company) company.add_job(self) company.company_url = attributes[:company_url] end
reset()
click to toggle source
# File lib/digital_nomad_jobs/job.rb, line 28 def self.reset @@all.clear end
Public Instance Methods
add_job_description(hash)
click to toggle source
# File lib/digital_nomad_jobs/job.rb, line 20 def add_job_description(hash) hash.each {|key, value| self.send(("#{key}="), value)} end
print_job_description()
click to toggle source
# File lib/digital_nomad_jobs/job.rb, line 41 def print_job_description puts "==========================================================================================".blue puts "" puts "Position: ".blue + "#{self.title}" puts "Company: ".blue + "#{self.company}" puts "Posted: ".blue + "#{self.time_posted} ago" puts "Tags: ".blue + "#{self.skills}" puts "" puts "Description: ".blue + "#{self.description}" puts "" puts "Learn More or Apply at: ".blue + "#{'https://remoteok.io' + self.job_url}" puts "==========================================================================================".blue end