morse_contactable 1.0.8 → 1.0.9

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: 69cad68cca61e9d7f3e897714c325284ce9644c0
4
- data.tar.gz: baaf6284a523604c6fd8444495b515f0efd5c745
3
+ metadata.gz: bf2c3205adc34c5cfe6a15dd4116e52da9dd9a3b
4
+ data.tar.gz: 9dc10b87a45c9e3c58c47d021541a0bd58ccb23d
5
5
  SHA512:
6
- metadata.gz: 5c9e92a0e7caf7f785dc78b1cb0a33f0d50a1bcca47c0386ebdbd453c4b58a7aaf9b137dbf08a32c6e3d16279cd7e7679c9f751f00042e52cd3ea9f852004eae
7
- data.tar.gz: ab437ea0b1c733543557b54e81f16a2ae5fddcdf8fa1d0fba2fcbb470615c91193715afb6a97261cf25fb9d9265a556f14e39500fe788be9b6363a3d8d883209
6
+ metadata.gz: f5af1a639b6f80fc8ffb1607cc720b8a210191254f2d68ee06e0f14b4b71f252ecbb92e5b8d7d0e82596bd6c891fe32c79a86257198bccb9644235f0ecb8a2c8
7
+ data.tar.gz: b8ec8bf816f17cdc6e83e5f2d0e6b6a4a9044dc46c3bada2acaa297b92a4c7de71a401a2e4038e051af80a3d21f64aafe33fc02746745fa5589488c63f31b951
data/lib/addressable.rb CHANGED
@@ -2,7 +2,7 @@ module Addressable
2
2
  extend ActiveSupport::Concern
3
3
  include FieldsValidator
4
4
  REQUIRED_DATABASE_FIELDS = [:address1, :address2, :address3, :town, :county, :country, :postcode]
5
-
5
+
6
6
  included do
7
7
  validate_required_attributes
8
8
  end
@@ -25,6 +25,10 @@ module Addressable
25
25
 
26
26
  public
27
27
 
28
+ def address_array
29
+ Array.new.tap { |a| REQUIRED_DATABASE_FIELDS.select { |key| a<<self.send(key) } }
30
+ end
31
+
28
32
  def address_pretty
29
33
  stringify_array address_array
30
34
  end
@@ -34,7 +38,7 @@ module Addressable
34
38
  end
35
39
 
36
40
  def city=(thing)
37
- self.town = thing
41
+ self.town = thing
38
42
  end
39
43
 
40
44
  def state
@@ -42,7 +46,7 @@ module Addressable
42
46
  end
43
47
 
44
48
  def state=(thing)
45
- self.county = thing
49
+ self.county = thing
46
50
  end
47
51
 
48
52
  def zip
@@ -50,7 +54,7 @@ module Addressable
50
54
  end
51
55
 
52
56
  def zip=(thing)
53
- self.postcode = thing
57
+ self.postcode = thing
54
58
  end
55
59
 
56
60
  def zipcode
@@ -58,15 +62,11 @@ module Addressable
58
62
  end
59
63
 
60
64
  def zipcode=(thing)
61
- self.postcode = thing
65
+ self.postcode = thing
62
66
  end
63
67
 
64
68
  private
65
69
 
66
- def address_array
67
- Array.new.tap { |a| REQUIRED_DATABASE_FIELDS.select { |key| a<<self.send(key) } }
68
- end
69
-
70
70
  def stringify_array(array)
71
71
  array.compact.join(", ")
72
72
  end
@@ -1,3 +1,3 @@
1
1
  module MorseContactable
2
- VERSION = "1.0.8"
2
+ VERSION = "1.0.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: morse_contactable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - fredmcgroarty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-11 00:00:00.000000000 Z
11
+ date: 2016-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: morse_fields_validator