jobparser 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/jobparser/facets/deadline.rb +21 -4
- data/lib/jobparser/version.rb +1 -1
- metadata +2 -2
@@ -8,16 +8,33 @@ module JobParser
|
|
8
8
|
return special_case_result unless special_case_result.nil?
|
9
9
|
|
10
10
|
regex = /(Apply before|Closing Date):\s*(.+)$/i
|
11
|
+
result = ""
|
11
12
|
loop_over_elements { |name, elem|
|
12
13
|
regex.match(elem.content) { |m|
|
13
|
-
|
14
|
+
result = Cleaner.strip_all_white_space(m[2])
|
14
15
|
}
|
15
|
-
}
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
if result.empty?
|
18
|
+
result = Cleaner.strip_all_white_space(elem.content) if elem_is_date(elem)
|
19
|
+
end
|
19
20
|
}
|
21
|
+
result
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
20
25
|
|
26
|
+
def elem_is_date(elem)
|
27
|
+
content = Cleaner.strip_all_white_space(elem.content)
|
28
|
+
words = content.split(" ").length
|
29
|
+
return false if words > 10 || words < 2
|
30
|
+
is_date = false
|
31
|
+
begin
|
32
|
+
Date.parse(content)
|
33
|
+
is_date = true
|
34
|
+
rescue ArgumentError
|
35
|
+
is_date = false
|
36
|
+
end
|
37
|
+
is_date
|
21
38
|
end
|
22
39
|
end
|
23
40
|
end
|
data/lib/jobparser/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jobparser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|