get-your-rep 1.3.0 → 1.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 52bf8ddb67a097e898e730ca14c1e96704bcc5bd
4
- data.tar.gz: a0323f417342ec9ddc7857768b56cb069da3af9a
3
+ metadata.gz: 6b65ff3454591d1ede812f534a057153baf8fa42
4
+ data.tar.gz: 72af8fb79c5af6203b79dd139be79cb75f779d21
5
5
  SHA512:
6
- metadata.gz: 95d92d07420e9fc505f703e5da1902c32597a5587a3623eaf68a4994efc527808ce80970e6626fea9aa57018209987d171e55f88d7683bd14b2e5d391fe408fc
7
- data.tar.gz: 79e7bfd8d754f4de15916c072c13dbdbdac884babfefb2285ff3d5269d03cc703c2f29370a1716b40199c918e3fc2fe69f522480050a24aaa39c32da0d41e340
6
+ metadata.gz: a5daecb7e779110c1bdb7fa16fd96aa258cefe0c4ff8ee2ac7a014fdf4ac5f6eb05299217be4c6e04425b293b46db79fac996875ee2ff05005424b3217b28fd0
7
+ data.tar.gz: 3e8b8d9ec37957ac72d76aec2603c89a7a3e53ca808ea76bb745d0d6ffd8d7ccef72935cba67bafc2194d440bb59d4a7860f18d21bea10e1ef36c7d03659937e
@@ -21,12 +21,24 @@ class Delegation < Array
21
21
 
22
22
  # Collects the first names of every rep in the Delegation.
23
23
  def first_names
24
- self.map { |rep| rep[:name].split[0..-2].join(' ') }
24
+ self.map do |rep|
25
+ if (rep[:name].split.count > 3) || (rep[:name].split[-2].downcase == rep[:name].split[-2])
26
+ rep[:name].split[0..-3].join(' ')
27
+ else
28
+ rep[:name].split[0..-2].join(' ')
29
+ end
30
+ end
25
31
  end
26
32
 
27
33
  # Collects the last names of every rep in the Delegation.
28
34
  def last_names
29
- self.map { |rep| rep[:name].split.last }
35
+ self.map do |rep|
36
+ if (rep[:name].split.count > 3) || (rep[:name].split[-2].downcase == rep[:name].split[-2])
37
+ rep[:name].split[-2..-1].join(' ')
38
+ else
39
+ rep[:name].split.last
40
+ end
41
+ end
30
42
  end
31
43
 
32
44
  # Maps attributes to a simple array for easy printing, iteration, and display. It uses #each rather than #map so it can skip over nil values without mapping them.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: get-your-rep
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - msimonborg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-12 00:00:00.000000000 Z
11
+ date: 2016-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -94,7 +94,7 @@ dependencies:
94
94
  version: '10'
95
95
  description: Get your rep with Google's Civic Information API using your address and
96
96
  API key. Check the documentation and README for new search options added in this
97
- release.
97
+ version 1.3. This patch fixes some incorrect handling of multi-word surnames.
98
98
  email: msimonborg@gmail.com
99
99
  executables: []
100
100
  extensions: []