jobparser 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- return Cleaner.strip_all_white_space(m[2])
14
+ result = Cleaner.strip_all_white_space(m[2])
14
15
  }
15
- }
16
16
 
17
- regex.match(@plain_text) { |m|
18
- # return Cleaner.strip_all_white_space(m[2])
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
@@ -1,3 +1,3 @@
1
1
  module JobParser
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
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.0
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-07-31 00:00:00.000000000 Z
12
+ date: 2013-08-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler