uniqable 0.3.5 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/Gemfile.lock +3 -1
- data/lib/uniqable.rb +2 -1
- data/lib/uniqable/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7edbf8a971d79a67b238754e0f0b05c32b93a71042a3b7dfa56a7b0893b74328
|
4
|
+
data.tar.gz: 54525e00eed37d7238c3638c07b58a1a93b9fdf92b02d8166c0959e05ddf956a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 564996a410171fcefa1219db14a0eb9908df7ac0f436b2902bf2bb1e80494c816ca44c8605ea8668c849994b86b2a81f187b460ba331339159dbf0f71a7e050d
|
7
|
+
data.tar.gz: 15c687084a4da77585af395dec754330b6404afa93017137ab0696e324982a637698a5d014e676e19685d26a9941e9c68615a767d631eb57135e6dfda836c8c6
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
uniqable (0.
|
4
|
+
uniqable (0.4)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -25,6 +25,7 @@ GEM
|
|
25
25
|
i18n (1.8.3)
|
26
26
|
concurrent-ruby (~> 1.0)
|
27
27
|
minitest (5.14.1)
|
28
|
+
nanoid (2.0.0)
|
28
29
|
parallel (1.19.2)
|
29
30
|
parser (2.7.1.4)
|
30
31
|
ast (~> 2.4.1)
|
@@ -72,6 +73,7 @@ DEPENDENCIES
|
|
72
73
|
activerecord (~> 5.0)
|
73
74
|
awesome_print (~> 1.8.0)
|
74
75
|
bundler (~> 1.16)
|
76
|
+
nanoid
|
75
77
|
rake (>= 13.0.1)
|
76
78
|
rspec (~> 3.9)
|
77
79
|
rspec_junit_formatter
|
data/lib/uniqable.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'uniqable/version'
|
4
|
+
require 'nanoid'
|
4
5
|
|
5
6
|
# Generates uniq, random token for ActiveRecord model's fields
|
6
7
|
module Uniqable
|
@@ -66,7 +67,7 @@ module Uniqable
|
|
66
67
|
# @TODO: split into 2 actions generate and set
|
67
68
|
def uniqable_uid(field)
|
68
69
|
loop do
|
69
|
-
uniq_code =
|
70
|
+
uniq_code = Nanoid.generate(size: 16)
|
70
71
|
if uniq_code =~ /\D+/
|
71
72
|
send("#{field}=", uniq_code)
|
72
73
|
break unless self.class.where(field => uniq_code).exists?
|
data/lib/uniqable/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uniqable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Renat "MpaK" Ibragimov
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -137,7 +137,7 @@ files:
|
|
137
137
|
homepage: https://github.com/mpakus/uniqable
|
138
138
|
licenses: []
|
139
139
|
metadata: {}
|
140
|
-
post_install_message:
|
140
|
+
post_install_message:
|
141
141
|
rdoc_options: []
|
142
142
|
require_paths:
|
143
143
|
- lib
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
version: '0'
|
154
154
|
requirements: []
|
155
155
|
rubygems_version: 3.0.8
|
156
|
-
signing_key:
|
156
|
+
signing_key:
|
157
157
|
specification_version: 4
|
158
158
|
summary: Uniqable - uniq and random token for ActiveRecord models
|
159
159
|
test_files: []
|