nxt_support 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -3
- data/Gemfile.lock +4 -4
- data/README.md +4 -0
- data/bin/rspec +29 -0
- data/lib/nxt_support/models.rb +2 -1
- data/lib/nxt_support/models/email.rb +12 -0
- data/lib/nxt_support/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 469fc9a13f4a9363e12d67a2640d9b28bdde711acf66fecbb2b42da9ab2a3824
|
4
|
+
data.tar.gz: 46a8fbd8d133be5e79e6d5652dc4ecfcc23d7550f47a06396149216accf85848
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c34b8ea6c57ddfac5861d6c5aac8baf42c5d51f93441ae1605384f2ab4ecfbe0dcebc3e749e4db396e8b529047962d0bf2b49d346e5e54515824db90a158ca8
|
7
|
+
data.tar.gz: 7a24934f8045dcbc45dfa6ee9bc48ebc023502ee66208e55bb4d0ebbc273d31271857b04e1d699567549e08c82bd49c41e417c72a353c3451e931da48312d09e
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nxt_support (0.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.
|
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.
|
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.
|
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.
|
data/bin/rspec
ADDED
@@ -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")
|
data/lib/nxt_support/models.rb
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
require "nxt_support/models/
|
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
|
data/lib/nxt_support/version.rb
CHANGED
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.
|
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-
|
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
|