nxt_support 0.1.1 → 0.1.2

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
  SHA256:
3
- metadata.gz: e2e9bc399563fcfba0a583d25022018b68a6f5041606d3751a1ad68f9253a62b
4
- data.tar.gz: 6683f7e84615d951c4d2f57736ab8b1a1c3a5c4d4f77a668a8a3a774afa06572
3
+ metadata.gz: 469fc9a13f4a9363e12d67a2640d9b28bdde711acf66fecbb2b42da9ab2a3824
4
+ data.tar.gz: 46a8fbd8d133be5e79e6d5652dc4ecfcc23d7550f47a06396149216accf85848
5
5
  SHA512:
6
- metadata.gz: 44ac6bd228b5d74ae962ac4d58797141858d917a42e733746418c527b7c420cecae82534ad009eca117fcfc2b8a55ab1355a5d1d7887c4d836df66b942df9d08
7
- data.tar.gz: 8277a6be281c241668ab376c26fff2a72c3e580594c180049232d22ef58a2a442de60937a7e5fc51ed6b9ef07ae7c47c53ba1e1baffe87b81b99e1a3c2a54706
6
+ metadata.gz: 1c34b8ea6c57ddfac5861d6c5aac8baf42c5d51f93441ae1605384f2ab4ecfbe0dcebc3e749e4db396e8b529047962d0bf2b49d346e5e54515824db90a158ca8
7
+ data.tar.gz: 7a24934f8045dcbc45dfa6ee9bc48ebc023502ee66208e55bb4d0ebbc273d31271857b04e1d699567549e08c82bd49c41e417c72a353c3451e931da48312d09e
@@ -1,8 +1,8 @@
1
- # Unreleased
1
+ # v0.1.2 2020-02-12
2
2
 
3
- Todo
3
+ - Added `NxtSupport::Email`.
4
4
 
5
- # v0.1.1 2019-02-04
5
+ # v0.1.1 2020-02-04
6
6
 
7
7
  ### Added
8
8
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nxt_support (0.1.1)
4
+ nxt_support (0.1.2)
5
5
  rails
6
6
 
7
7
  GEM
@@ -64,7 +64,7 @@ GEM
64
64
  zeitwerk (~> 2.2)
65
65
  builder (3.2.4)
66
66
  coderay (1.1.2)
67
- concurrent-ruby (1.1.5)
67
+ concurrent-ruby (1.1.6)
68
68
  crass (1.0.6)
69
69
  diff-lcs (1.3)
70
70
  erubi (1.9.0)
@@ -85,12 +85,12 @@ GEM
85
85
  mini_portile2 (2.4.0)
86
86
  minitest (5.14.0)
87
87
  nio4r (2.5.2)
88
- nokogiri (1.10.7)
88
+ nokogiri (1.10.8)
89
89
  mini_portile2 (~> 2.4.0)
90
90
  pry (0.12.2)
91
91
  coderay (~> 1.1.0)
92
92
  method_source (~> 0.9.0)
93
- rack (2.1.2)
93
+ rack (2.2.2)
94
94
  rack-test (1.1.0)
95
95
  rack (>= 1.0, < 3)
96
96
  rails (6.0.2.1)
data/README.md CHANGED
@@ -28,6 +28,10 @@ Here's an overview all the supporting features.
28
28
 
29
29
  Enjoy support for your models.
30
30
 
31
+ #### NxtSupport::Email
32
+
33
+ This class collects useful tools around working with email addresses. Use `NxtSupport::Email::REGEXP` to match email address strings. See the sources for a list of criteria it validates.
34
+
31
35
  #### NxtSupport::SafelyFindOrCreateable
32
36
 
33
37
  The `NxtSupport::Models::SafelyFindOrCreateable` concern is aimed at ActiveRecord models with a uniqueness database constraint. If you use `find_or_create_by` from ActiveRecord, it can happen that the `find_by` call returns `nil` (because no record for the given conditions exists), but in the small timeframe between the `find_by` and the `create` call, another thread inserts a record, so that the `create` call raises an error.
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rspec-core", "rspec")
@@ -1 +1,2 @@
1
- require "nxt_support/models/safely_find_or_createable"
1
+ require "nxt_support/models/email"
2
+ require "nxt_support/models/safely_find_or_createable"
@@ -0,0 +1,12 @@
1
+ module NxtSupport
2
+ class Email
3
+ # We enforce
4
+ # (1) Exactly one '@' char prepended and appended by other text
5
+ # (2) No whitespace characters
6
+ # (3) At least one non-whitespace character before the '@' character
7
+ # (4) No dot ('.') character directly after the '@' character
8
+ # (5) A hostname after the '@' character of at least two non-whitespace characters length
9
+ # (6) At least one top level domain ending (e.g. '.com') after the hostname, separated from the hostname by a dot ('.')
10
+ REGEXP = /\A[^@\s]+@[^\.][^@\s]+\.[^@\s]+\z/.freeze
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module NxtSupport
2
- VERSION = "0.1.1".freeze
2
+ VERSION = "0.1.2".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nxt_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nils Sommer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-02-04 00:00:00.000000000 Z
12
+ date: 2020-02-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -116,9 +116,11 @@ files:
116
116
  - README.md
117
117
  - Rakefile
118
118
  - bin/console
119
+ - bin/rspec
119
120
  - bin/setup
120
121
  - lib/nxt_support.rb
121
122
  - lib/nxt_support/models.rb
123
+ - lib/nxt_support/models/email.rb
122
124
  - lib/nxt_support/models/safely_find_or_createable.rb
123
125
  - lib/nxt_support/util.rb
124
126
  - lib/nxt_support/util/enum_hash.rb