-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjob.rb
43 lines (35 loc) · 1.23 KB
/
job.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Copyright 2011 Marco Dinacci <[email protected]> / www.intransitione.com
#
# Hi, this program reads jobs listings from the careers.stackoverflow.com website and
# dump it on a file. It then read back the data and output JSON files ready to be
# used with the Google Visualization API.
#
# You are free to do what you want with it except pretend that you wrote it.
# If you redistribute it, keep the copyright line above.
#
# This module contains the Job related classes.
module Job
class Job
attr_accessor :title, :tags, :score, :locations, :description
def initialize
@tags = []
@locations = []
@description = nil
end
def to_s
"#{@title} - #{@locations} (#{@score}) \n #{@description} \n #{@tags}\n"
end
def telecommute?
# Return true whether the string 'telecommut' (could be telecommutE or telecommutING)
# is contained in any of the fields
can_telecommute = false
[@title,@locations,@description,@locations].flatten.each do |field|
can_telecommute = !field.downcase.index("telecommut").nil?
if can_telecommute
break
end
end
return can_telecommute
end
end
end