contacts_txt 0.1.0 → 0.1.1

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: f64f636af43564a972be03194347dcefbb3ba530
4
- data.tar.gz: 5737297dfe22c8170439a04523c2c9704f7db98a
3
+ metadata.gz: 8b04f5d5c2877130ad7148f8f70f59a7152c952a
4
+ data.tar.gz: 4ec53ce5b4a212a1ecaa0b948880d5ab9ebc5ea4
5
5
  SHA512:
6
- metadata.gz: d322402305545cbbdb64ca8d4163b00c9ca5e2a02fe78c80c4f27cd05125ca38431278fa341c7299e3641152e3d2677c87134ce473683b371b16e77c423b3e96
7
- data.tar.gz: 962b91e23c431f1e8b80e7f4caa2f80280415088a7cb8dbc48f07711d9f8ed03507fdf696af6c7b406da0ca9bef6005fb3482c99f1cece3830e5b96a2618d957
6
+ metadata.gz: e8d499c9199611a2b4d20606707a6030e5d9fa38d35aa70a43a0b79d4dfe134b69d2104e251f11055472622e9d25f4e80a7243a245b04d03b04c99701cdd7808
7
+ data.tar.gz: 1aa070d581222a12060a720c44fca986a707fecb2f328182d2b11c414dfb6dceba0139458790613e08d131bdefc6781bbac19e4c74975eb5770cf571a6b2c63c
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/contacts_txt.rb CHANGED
@@ -9,28 +9,34 @@ class ContactsTxt
9
9
 
10
10
  attr_reader :to_s
11
11
 
12
- def initialize(filename='contacts.txt', path: '.', \
13
- fields: %w(tags email address notes))
12
+ def initialize(raw_filename='contacts.txt', path: File.dirname(raw_filename), \
13
+ fields: %w(mobile email dob tags address notes))
14
14
  @fields = %w(fullname firstname lastname tel) | fields
15
- @filename, @path = filename, path
16
15
 
17
- fpath = File.join(path, filename)
16
+ @path = path
17
+ @filename = path == '.' ? raw_filename : File.basename(raw_filename)
18
+
19
+ fpath = File.join(path, @filename)
18
20
 
19
- @dx = if File.exists?(fpath) then
20
- import_to_dx(File.read(fpath))
21
- else
22
- new_dx()
23
- end
21
+ @dx = File.exists?(fpath) ? import_to_dx(File.read(fpath)) : new_dx()
22
+
24
23
  end
25
24
 
26
25
  def dx()
27
26
  @dx
28
27
  end
28
+
29
+ # returns a Dynarex object
30
+ #
31
+ def email_list()
32
+ @dx.filter {|x| x.email.length > 0}
33
+ end
29
34
 
30
35
  def save(filename=@filename)
31
36
 
32
37
  s = dx_to_s(@dx, title: File.basename(filename) )
33
38
  File.write File.join(@path, filename), s
39
+ @dx.save File.join(@path, filename.sub(/\.txt$/,'.xml'))
34
40
 
35
41
  end
36
42
 
@@ -73,4 +79,4 @@ class ContactsTxt
73
79
 
74
80
  end
75
81
 
76
- end
82
+ end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contacts_txt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -12,26 +12,26 @@ cert_chain:
12
12
  -----BEGIN CERTIFICATE-----
13
13
  MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
14
  YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
- 8ixkARkWAmV1MB4XDTE1MTIxMzEyNDkzMloXDTE2MTIxMjEyNDkzMlowSDESMBAG
15
+ 8ixkARkWAmV1MB4XDTE2MTIyMzIwMDMyNFoXDTE3MTIyMzIwMDMyNFowSDESMBAG
16
16
  A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
17
  EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
- ggEBAKaGL7pczYxS8DzY71I4D3Bkw2EHjstcaG2czifrP5KeSMA1tO9QqwxoX1lp
19
- nSzK/1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OyhP0RsgjhO8/6+ndp2L
28
- Bs9fkDwDqIwZ0r1Jy4JYNRZug/LzuxXv51IWa3yN+b/JIybQobdUsLP3W4xng+mS
29
- zydGYLPehHYag4MtK+hb3L9uYj/NDWKgSBi5aTm2p8r+e0pHrhRHDwbl+gtKDjyn
30
- ij71NTxNLGkHUd4D7WadOvkDzpCrz8uQ8EJktnsidwvlyTq/ZdmiQ0WhfLFYjjeN
31
- 8BrWDFGNkIWV3yB/gSHs8fdeilDhOC6aNlKtykxtMiM68u+9GhOj3HtgmLAdp9zC
32
- m8j9CN8cBtwSBA==
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAqjB2dRPf
27
+ +giBQGMKo5v2V7MkHhW2HzdwkAMVbak5bt314xuGUpENt0z9beRb45Yj9MfQOCZX
28
+ LLaWB+J++ccWf01ipxbzJKXamUVSZ2INUvoimMmoYM+SsA6hwf1V2e895wRG8rEy
29
+ rsuGRU4Kj+Jxep0qhSbWlazevHIpfi1Zp9EjDV17pGucR/AkcTz0w/1Rw9Z612Uw
30
+ R7ixbLmgNwX462tf7ejLWzoPxzEEPdcWUA0YPWeohY+IomrMMjpX7bxSwyYNOya7
31
+ Ebw/4t8+mfs6ivuW6xdj3SlqhEXlfJ83mZuvJ3LtQteR5p0R8DSLcTXMkOrWD6wC
32
+ 07GXbdChvjqXQg==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-12-13 00:00:00.000000000 Z
34
+ date: 2016-12-23 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: dynarex
@@ -39,20 +39,20 @@ dependencies:
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '1.5'
42
+ version: '1.7'
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 1.5.44
45
+ version: 1.7.17
46
46
  type: :runtime
47
47
  prerelease: false
48
48
  version_requirements: !ruby/object:Gem::Requirement
49
49
  requirements:
50
50
  - - "~>"
51
51
  - !ruby/object:Gem::Version
52
- version: '1.5'
52
+ version: '1.7'
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 1.5.44
55
+ version: 1.7.17
56
56
  description:
57
57
  email: james@r0bertson.co.uk
58
58
  executables: []
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  version: '0'
81
81
  requirements: []
82
82
  rubyforge_project:
83
- rubygems_version: 2.4.8
83
+ rubygems_version: 2.5.1
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: Reads a contacts.txt file
metadata.gz.sig CHANGED
Binary file