parse_name_from_email 0.1.1 → 0.2.0

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: 87209329932e67826ef80a89a4a06f68f7aa0218
4
- data.tar.gz: 081ffd5f29f0daa48e04d29341186a61e7caf20f
3
+ metadata.gz: 61870c91f8bfaf73e081febd793f324ac1ab9a8f
4
+ data.tar.gz: b3f546ba1ab5af426a7792a6979ac7934969768b
5
5
  SHA512:
6
- metadata.gz: 70cab014ff491ef60cbccf19c843c821c1deb0f7f1489fb166c9c6da2893f0d00eaa96b8920317553835c45d52c28f0588e728ef268a0e0d6d13dc521f010948
7
- data.tar.gz: ef45bdfa5dee1255b5b034910f45f1c2f58947d6003bab0f81d87db4b9827f914646f24d0b6aace4fa338adb4e766048b3282ee8ba43ea31b8b31345af6dd527
6
+ metadata.gz: c37024925c9b2070714c822a83643201f88910bf19526b38c2fe2c79e2f4e54dd5781fd9e988184361395d6a23f18bc143f4c57d13e04a6c1ea6ddd32974a4b3
7
+ data.tar.gz: e6d95a5bb26181f38efdd282b4250ebc84820203a114f3ea01295b37e68d219bfbb8985b7fce6075bac6865c656b0673a56d771236a11488f2dc08d90a4390b4
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ParseNameFromEmail
2
2
 
3
- [![GitHub version](https://badge.fury.io/gh/parse_name_from_email.svg)](https://badge.fury.io/gh/parse_name_from_email)
3
+ [![Gem Version](https://badge.fury.io/rb/parse_name_from_email.svg)](https://badge.fury.io/rb/parse_name_from_email)
4
4
  [![Build Status](https://travis-ci.org/Applifting/parse_name_from_email.svg?branch=master)](https://travis-ci.org/Applifting/parse_name_from_email)
5
5
  [![Coverage Status](https://coveralls.io/repos/github/Applifting/parse_name_from_email/badge.svg?branch=master)](https://coveralls.io/github/Applifting/parse_name_from_email?branch=master)
6
6
 
@@ -59,7 +59,7 @@ ParseNameFromEmail.get_email_name('john-snow+nickname@example.com') # => 'john-s
59
59
  ParseNameFromEmail.parse_name_from('JohnSnow@example.com') # => 'John Snow'
60
60
  ParseNameFromEmail.parse_name_from('john-snow@example.com') # => 'John Snow'
61
61
  ParseNameFromEmail.parse_name_from('john_snow@example.com') # => 'John Snow'
62
- ParseNameFromEmail.parse_name_from('john123snow@example.com') # => 'John 123 Snow'
62
+ ParseNameFromEmail.parse_name_from('john123snow@example.com') # => 'John Snow'
63
63
  ParseNameFromEmail.parse_name_from('John Snow <john.snow@example.com>') # => 'John Snow'
64
64
 
65
65
  # validating RFC format of email
@@ -74,10 +74,10 @@ ParseNameFromEmail.parse_name_from('JohnSnow+Nickname123@example.com') # => 'Joh
74
74
 
75
75
  # batches
76
76
  string_with_emails = 'John Snow <john.snow@example.com>, alice.123@3x4mpl3.app'
77
- ParseNameFromEmail.parse_names_from(string_with_emails) # => ['John Snow', 'Alice 123']
77
+ ParseNameFromEmail.parse_names_from(string_with_emails) # => ['John Snow', 'Alice']
78
78
 
79
79
  string_with_emails = 'lily+black@example.com, alice.123@3x4mpl3.app'
80
- ParseNameFromEmail.parse_names_from(string_with_emails) # => ['Lily (black)', 'Alice 123']
80
+ ParseNameFromEmail.parse_names_from(string_with_emails) # => ['Lily (black)', 'Alice']
81
81
 
82
82
  # advanced parsing
83
83
  string_with_emails = 'john.snow@example.com, lily+black@example.com'
@@ -3,7 +3,7 @@ module ParseNameFromEmail
3
3
  attr_accessor :regexp, :friendly_plus_part
4
4
 
5
5
  def initialize
6
- # split email address with regexp
6
+ # split email address with regexp (test: https://regex101.com/r/pF5mS4)
7
7
  @regexp = /(?=[A-Z])|(?:([0-9]+))|\.|-|\?|!|\+|\;|\_/
8
8
 
9
9
  ## Recognizing plus parts in gmail addresses
@@ -1,3 +1,3 @@
1
1
  module ParseNameFromEmail
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
@@ -100,7 +100,7 @@ module ParseNameFromEmail
100
100
  # after regex join it with blank space and upcase first letters
101
101
  def make_human_readable(array)
102
102
  humanized_elements = array.map { |el| el.strip.humanize }
103
- humanized_elements.reject(&:empty?).join(' ')
103
+ humanized_elements.reject(&:empty?).reject{ |str| str =~ /\d/ }.join(' ')
104
104
  end
105
105
 
106
106
  # match regexp if is valid rfc format
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parse_name_from_email
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Prokop Simek, Applifting
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-10 00:00:00.000000000 Z
11
+ date: 2016-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -59,6 +59,7 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - ".coveralls.yml"
62
63
  - ".gitignore"
63
64
  - ".travis.yml"
64
65
  - Gemfile