string_pattern 1.4.1 → 1.5.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 +4 -4
- data/lib/string_pattern.rb +9 -3
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b3cd24566b10d29d53ae0dc90ae200ff772aa2673582f46870cb6a7b10b5503
|
4
|
+
data.tar.gz: dfa03622a4504169004dfae4694de64df274ac1d2977a1c1e271dd48b5aff97a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92309292bf67be968e6212ab37b6a32f7019b54b7d45f71a60208cf3e5ec4a0320875cafd0bafda607dce4398daf9a480e59f6212df99bfe6c31176f620f937f
|
7
|
+
data.tar.gz: dfa1507522d70a2926e783def52c32af007156592c65e4dd7f0abb3a36126e0cc5ba74c58cc2e757de2e1bd2704b7e41f2b2d75d92ca735789de31328bc93357
|
data/lib/string_pattern.rb
CHANGED
@@ -34,7 +34,7 @@ class StringPattern
|
|
34
34
|
|
35
35
|
|
36
36
|
Pattern = Struct.new(:min_length, :max_length, :symbol_type, :required_data, :excluded_data, :data_provided,
|
37
|
-
:string_set, :all_characters_set)
|
37
|
+
:string_set, :all_characters_set, :unique)
|
38
38
|
|
39
39
|
###############################################
|
40
40
|
# Analyze the pattern supplied and returns an object of Pattern structure including:
|
@@ -51,6 +51,12 @@ class StringPattern
|
|
51
51
|
return pattern.to_s
|
52
52
|
end
|
53
53
|
end
|
54
|
+
if symbol_type[-1]=="&"
|
55
|
+
symbol_type.chop!
|
56
|
+
unique = true
|
57
|
+
else
|
58
|
+
unique = false
|
59
|
+
end
|
54
60
|
|
55
61
|
symbol_type = '!' + symbol_type if pattern.to_s[0] == '!'
|
56
62
|
min_length = min_length.to_i
|
@@ -215,7 +221,7 @@ class StringPattern
|
|
215
221
|
end
|
216
222
|
string_set.uniq!
|
217
223
|
@cache[pattern.to_s] = Pattern.new(min_length, max_length, symbol_type, required_data, excluded_data, data_provided,
|
218
|
-
string_set, all_characters_set)
|
224
|
+
string_set, all_characters_set, unique)
|
219
225
|
return @cache[pattern.to_s]
|
220
226
|
end
|
221
227
|
|
@@ -671,7 +677,7 @@ class StringPattern
|
|
671
677
|
good_result = true
|
672
678
|
end
|
673
679
|
end
|
674
|
-
if pattern.kind_of?(Symbol) and
|
680
|
+
if pattern.kind_of?(Symbol) and patt.unique
|
675
681
|
if @cache_values[pattern.__id__].nil?
|
676
682
|
@cache_values[pattern.__id__] = Array.new()
|
677
683
|
@cache_values[pattern.__id__].push(string)
|
metadata
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: string_pattern
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: You can easily generate strings supplying a very simple pattern.
|
14
|
-
you can validate if a text fulfills a specific pattern or
|
15
|
-
following a pattern and returning the wrong length, value...
|
13
|
+
description: 'You can easily generate strings supplying a very simple pattern. ''10-20:Xn/x/''.generate
|
14
|
+
#>qBstvc6JN8ra. Also, you can validate if a text fulfills a specific pattern or
|
15
|
+
even generate a string following a pattern and returning the wrong length, value...
|
16
|
+
for testing your applications.'
|
16
17
|
email: marioruizs@gmail.com
|
17
18
|
executables: []
|
18
19
|
extensions: []
|
@@ -48,6 +49,6 @@ rubyforge_project:
|
|
48
49
|
rubygems_version: 2.7.6
|
49
50
|
signing_key:
|
50
51
|
specification_version: 4
|
51
|
-
summary: '
|
52
|
+
summary: 'Generate easily random strings following a simple pattern. ''10-20:Xn/x/''.generate
|
52
53
|
#>qBstvc6JN8ra'
|
53
54
|
test_files: []
|