piplrequest 0.0.3 → 0.0.4
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/piplrequest.rb +13 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abffbd1dfea7a25eac5b70ca9cb6bc142163f6c2
|
4
|
+
data.tar.gz: 4dea6e30dfce129818a80d2cdef5345843443944
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f94bf4a559605ccce62f74040327176701d92640ba292eb87a00403912de3bec75df827fdd466c0b3ca0e077227d1b9eb9bc535cfcd5aa6b8f97bd0048db50f8
|
7
|
+
data.tar.gz: 8b9729187fedd0993e5b5e709ec38f6c45c7ab3e43e2e7866a4763dcf5206155f8a0747b585786d3e437d08b2c16a8561ff2174d105fb774a67ae7c48cef5b2c
|
data/lib/piplrequest.rb
CHANGED
@@ -68,14 +68,23 @@ class PiplRequest
|
|
68
68
|
|
69
69
|
# Clean name fields to not include extra info
|
70
70
|
def clean_name(name)
|
71
|
-
|
71
|
+
without_parens = name.gsub(/\((?:[^()]+)\)/, "").strip.lstrip
|
72
|
+
without_slash = without_parens.split("/").first.strip
|
73
|
+
without_numerals = without_slash.gsub(/\s(?:I|V)+(?:\s|$)/, "").strip.lstrip
|
74
|
+
end
|
75
|
+
|
76
|
+
# Get the name content and clean it if it exists
|
77
|
+
def get_clean_name_content(data_item, type)
|
78
|
+
name = get_field_content(data_item, :name, type)
|
79
|
+
return clean_name(name) if name
|
72
80
|
end
|
73
81
|
|
74
82
|
# Generate the name
|
75
83
|
def gen_name(data_item)
|
76
|
-
return Pipl::Name.new(first:
|
77
|
-
last:
|
78
|
-
raw:
|
84
|
+
return Pipl::Name.new(first: get_clean_name_content(data_item, :first),
|
85
|
+
last: get_clean_name_content(data_item, :last),
|
86
|
+
raw: get_clean_name_content(data_item, :raw)
|
87
|
+
)
|
79
88
|
end
|
80
89
|
|
81
90
|
# Generate the URL
|