email_parser 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
  SHA256:
3
- metadata.gz: db08027dc80326267565a6d507007daa0a99d060c40780eebcc85ee419354d04
4
- data.tar.gz: 888d3a9342609310e2f194ddcf3888fd1b402a944eb5a3d17ccbbbafd6d0dc13
3
+ metadata.gz: 4ea1a1988ef62756778d13c2151fbe9ca21d7543054d97bda23deafce3603e3c
4
+ data.tar.gz: d8f123352b5bfcaacc4b44e205ce5a5fe27ce3212344e92a9dff1f54454d45c2
5
5
  SHA512:
6
- metadata.gz: 7495252e10dbf42fa77b3cf4a221564e5bf39f5aacf77aca1a9ff0f3a15364d3276cb0f0aa059bf2c16d7afb60fb59e3c5296eb87dd553b5dbd766d444acac7b
7
- data.tar.gz: 4b1c7b2e7f54c2656314d7caa7038911313d47f6af056d7f28b6a5578d97bb3de4f7ac68aee6c2f5d02be48494597b0aca585da2125bf1463eff6ada0698f20d
6
+ metadata.gz: 7a372f31baebd0855edffef741e4fbf9235d9620e8f3f935618be4d7f05aaf2963f427fbae01f6c49cafe0fbc0ede544fce24bc70f60a08dec5fc84a3a59bfa4
7
+ data.tar.gz: 9957b4f39069be665c645074e4afc3527ded5da57c87bb30ca9da8580697f478bbb8319b08eca9d7306ad2b8c61bf5113839d8986d2b668d1b6e81af1095d3dc
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # v0.1.1
2
+
3
+ - add option to allow domain beginning with number
4
+ - fix to parse hypenated domain label
5
+
1
6
  # v0.1.0
2
7
 
3
8
  - Initial release.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- email_parser (0.1.0)
4
+ email_parser (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -37,6 +37,7 @@ EmailParser.valid?("test.@example.com", allow_local_end_with_dot: true) # => tru
37
37
  ## Parser options
38
38
 
39
39
  - `allow_address_literal: true` allows `a@[127.0.0.1]` etc. (default: `false`)
40
+ - `allow_domain_label_begin_with_number: true` allows `a@123.com` etc.
40
41
  - `allow_dot_sequence_in_local: true` allows `a..b@example.com` etc. (default: `false`)
41
42
  - `allow_local_begin_with_dot: true` allows `.a@example.com` etc. (default: `false`)
42
43
  - `allow_local_end_with_dot: true` allows `a.@example.com` etc. (default: `false`)
data/email_parser.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
 
18
18
  spec.metadata["homepage_uri"] = spec.homepage
19
19
  spec.metadata["source_code_uri"] = "https://github.com/labocho/email_parser"
20
- spec.metadata["changelog_uri"] = "https://github.com/labocho/email_parser/master/CHANGELOG.md"
20
+ spec.metadata["changelog_uri"] = "https://github.com/labocho/email_parser/blob/master/CHANGELOG.md"
21
21
 
22
22
  # Specify which files should be added to the gem when it is released.
23
23
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -1,3 +1,3 @@
1
1
  class EmailParser
2
- VERSION = "0.1.0".freeze
2
+ VERSION = "0.1.1".freeze
3
3
  end
data/lib/email_parser.rb CHANGED
@@ -21,7 +21,7 @@ class EmailParser
21
21
  ")+",
22
22
  )
23
23
 
24
- attr_reader :allow_address_literal, :allow_dot_sequence_in_local, :allow_local_begin_with_dot, :allow_local_end_with_dot
24
+ attr_reader :allow_address_literal, :allow_domain_label_begin_with_number, :allow_dot_sequence_in_local, :allow_local_begin_with_dot, :allow_local_end_with_dot
25
25
 
26
26
  def self.parse(src, **options)
27
27
  new(**options).parse(src)
@@ -31,10 +31,11 @@ class EmailParser
31
31
  new(**options).valid?(src)
32
32
  end
33
33
 
34
- def initialize(allow_address_literal: false, allow_dot_sequence_in_local: false, allow_local_begin_with_dot: false, allow_local_end_with_dot: false)
34
+ def initialize(allow_address_literal: false, allow_domain_label_begin_with_number: false, allow_dot_sequence_in_local: false, allow_local_begin_with_dot: false, allow_local_end_with_dot: false)
35
35
  @allow_address_literal = allow_address_literal
36
36
  raise NotImplementedError("Sorry, `allow_address_literal == true` is not supported yet") if allow_address_literal
37
37
 
38
+ @allow_domain_label_begin_with_number = allow_domain_label_begin_with_number
38
39
  @allow_dot_sequence_in_local = allow_dot_sequence_in_local
39
40
  @allow_local_begin_with_dot = allow_local_begin_with_dot
40
41
  @allow_local_end_with_dot = allow_local_end_with_dot
@@ -170,10 +171,13 @@ class EmailParser
170
171
 
171
172
  def label(s)
172
173
  buffer = ""
173
- return unless push!(buffer, s.scan(/[a-zA-Z]/))
174
+
175
+ unless allow_domain_label_begin_with_number
176
+ return unless push!(buffer, s.scan(/[a-zA-Z]/))
177
+ end
174
178
 
175
179
  push!(buffer, s.scan(/[a-zA-Z0-9]+/))
176
- push!(buffer, s.scan(/(-[a-zA-Z0-9])+/))
180
+ push!(buffer, s.scan(/(-[a-zA-Z0-9]+)+/))
177
181
 
178
182
  [:label, buffer]
179
183
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_parser
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
  - labocho
@@ -112,7 +112,7 @@ metadata:
112
112
  allowed_push_host: https://rubygems.org
113
113
  homepage_uri: https://github.com/labocho/email_parser
114
114
  source_code_uri: https://github.com/labocho/email_parser
115
- changelog_uri: https://github.com/labocho/email_parser/master/CHANGELOG.md
115
+ changelog_uri: https://github.com/labocho/email_parser/blob/master/CHANGELOG.md
116
116
  post_install_message:
117
117
  rdoc_options: []
118
118
  require_paths: