dwc_agent 0.2.2 → 0.2.3
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.
- checksums.yaml +4 -4
- data/lib/dwc_agent/parser.rb +13 -7
- data/lib/dwc_agent/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b78266edf4bba3e709436eea17e10a3f368487ab6b2e2d500390f6f18eef8cd
|
4
|
+
data.tar.gz: 14464308a3ffb8139305eabdf04bfe032e0d6de526e303980ff4fe165165ec7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 805e512bbfb76d17b45ad33f0ac5d550f5c4e3add36f09d9fe5053169bc3a5e357783c7512b21f91a816288685ad97cf12b53540272b475d7bdd6172bb9ed83b
|
7
|
+
data.tar.gz: c220b4bedf8b8914035ce3a2e2e5e9742c566bcf28ce8b2488efbb9aa2c5dfd881819bf666c9583b9f1151c06b44425a7614e0d6ab5cda9d5ca2d68965d85130
|
data/lib/dwc_agent/parser.rb
CHANGED
@@ -14,6 +14,13 @@ module DwcAgent
|
|
14
14
|
title: TITLE
|
15
15
|
}
|
16
16
|
@namae = Namae::Parser.new(options)
|
17
|
+
|
18
|
+
@strip_out_regex = Regexp.new STRIP_OUT.to_s
|
19
|
+
@residual_terminators_regex = Regexp.new SPLIT_BY.to_s + %r{\s*\z}.to_s
|
20
|
+
@char_subs_regex = Regexp.new [CHAR_SUBS.keys.join('\\')].to_s
|
21
|
+
@phrase_subs_regex = Regexp.new (PHRASE_SUBS.keys.join('|')).to_s
|
22
|
+
@complex_separators_regex = Regexp.new COMPLEX_SEPARATORS.to_s
|
23
|
+
@add_separators_regex = Regexp.new %r{([A-Z]{1}\.)([[:alpha:]]{2,})}.to_s
|
17
24
|
end
|
18
25
|
|
19
26
|
# Parses the passed-in string and returns a list of names.
|
@@ -22,13 +29,12 @@ module DwcAgent
|
|
22
29
|
# @return [Array] the list of parsed names
|
23
30
|
def parse(name)
|
24
31
|
return [] if name.nil? || name == ""
|
25
|
-
|
26
|
-
name.gsub!(
|
27
|
-
name.gsub!(
|
28
|
-
name.gsub!(
|
29
|
-
name.gsub!(
|
30
|
-
name.gsub!(
|
31
|
-
name.gsub!(residual_terminators_regex, '')
|
32
|
+
name.gsub!(@strip_out_regex, ' ')
|
33
|
+
name.gsub!(@char_subs_regex, CHAR_SUBS)
|
34
|
+
name.gsub!(@phrase_subs_regex, PHRASE_SUBS)
|
35
|
+
name.gsub!(@add_separators_regex, '\1 \2')
|
36
|
+
name.gsub!(@complex_separators_regex, '\1 | \2')
|
37
|
+
name.gsub!(@residual_terminators_regex, '')
|
32
38
|
name.squeeze!(' ')
|
33
39
|
name.strip!
|
34
40
|
@namae.parse(name)
|
data/lib/dwc_agent/version.rb
CHANGED