paf 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b233ff56fedadfea9e1f21508ea7b6fb85f852c1
4
- data.tar.gz: 59dbbde56e750c387774368cad006e4d3e4a0a7c
3
+ metadata.gz: 7138b6a5f3acbe97f7f227410d48f972310a7d1a
4
+ data.tar.gz: ce12de78a4ca2e7f7556375de50fbc9cf143a982
5
5
  SHA512:
6
- metadata.gz: c379a989578aa2c9a0398f26dddf50d0cce40d15f0ddc8394e54e24bd7c13c016b30734ff3f2375ff985d63caf707d9b024c8720edade1ac3cccbf7a67b78779
7
- data.tar.gz: 7414a214e0a027bffa8c774f595844a208e75db227af5f2338e9e2f80804088f0e50a0ff39c69f2a5e01412582060d39faa36badd96365ebf630abc8a4a18579
6
+ metadata.gz: ddc67a2e7ea3e1e5493a45d37e5b80473532f3d33bd8c2a733e4bf0a6529e88caa532c8ac44f10dad0ca2dd9036f52ab12d330a0f05f686ce2407e4b5bc6db3b
7
+ data.tar.gz: 7d5b94a394240e8406eb53e947cb5fb010ee9cf4a3123d1d392b5f775c25338df46b71f98e827764fbb0590c5b7e97c70a0f905312d06cb60969c2f617ae397b
@@ -12,8 +12,7 @@ class Paf
12
12
  def lines
13
13
  [].tap do |lines|
14
14
  lines_methods.each do |method|
15
- value = send(method)
16
- (lines << value).flatten! unless value.vacant?
15
+ (lines << send(method)).flatten! unless send(method).vacant?
17
16
  end
18
17
  end
19
18
  end
@@ -1,36 +1,36 @@
1
1
  class Paf
2
2
  # Processing for thoroughfare and locality elements of a PAF entry
3
3
  module ThoroughfareLocality
4
- def thoroughfare_and_locality_attrs
5
- %i[dependent_thoroughfare thoroughfare] + self.class.locality_attrs
6
- end
7
-
8
4
  def thoroughfares_and_localities
9
5
  [].tap do |array|
10
6
  thoroughfare_and_locality_attrs.each do |attr|
11
- next if used?(attr)
12
- value = send(attr)
13
- array << value unless value.vacant?
7
+ array << send(attr) unless used_or_vacant?(attr)
14
8
  end
15
9
  end
16
10
  end
17
11
 
18
12
  private
19
13
 
14
+ def thoroughfare_and_locality_attrs
15
+ %i[dependent_thoroughfare thoroughfare] + self.class.locality_attrs
16
+ end
17
+
20
18
  def first_thoroughfare_or_locality
21
19
  send(first_thoroughfare_or_locality_attr) unless
22
20
  first_thoroughfare_or_locality_attr.nil?
23
21
  end
24
22
 
25
23
  def first_thoroughfare_or_locality_attr
26
- thoroughfare_and_locality_attrs.find do |attr|
27
- !send(attr).vacant?
28
- end
24
+ thoroughfare_and_locality_attrs.find { |attr| !send(attr).vacant? }
29
25
  end
30
26
 
31
27
  def used?(attr)
32
28
  premises_includes_first_thoroughfare_or_locality? &&
33
29
  (attr == first_thoroughfare_or_locality_attr)
34
30
  end
31
+
32
+ def used_or_vacant?(attr)
33
+ used?(attr) || send(attr).vacant?
34
+ end
35
35
  end
36
36
  end
@@ -1,4 +1,4 @@
1
1
  # PAF gem version
2
2
  class Paf
3
- VERSION = '0.4.0'.freeze
3
+ VERSION = '0.5.0'.freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Bard