regexp-collection 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile.lock +6 -6
- data/lib/regexp-collection.rb +10 -0
- data/lib/regexp-collection/version.rb +1 -1
- data/regexp-collection.gemspec +1 -1
- data/test/test-regexp-collection.rb +68 -0
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8def3fa3d688417ba7f665b2f125a41ca90d80441fdd16767bf394952a548d0b
|
4
|
+
data.tar.gz: 616aae231617f72b5dda7e32414e9563e537a45aea1008e5ace07581852b617c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca71c386e17198ebe0ae8a87c26d06450f0941ab49765797ad3aca1fd0c194e28a2b62267f388440685489e86caf5c3089da67fc784907ceb3d5a0cd0d281216
|
7
|
+
data.tar.gz: ce3c034b2dc4191d489135ca6c23508d6c5af20014c8052d511c4ba24a21438ca966681a975df2949e3f82e0adcd7a98d5c7e33dffbc1173a419b2ec4ef6770c
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.1
|
data/Gemfile.lock
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
regexp-collection (1.0
|
4
|
+
regexp-collection (1.1.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
power_assert (1.
|
10
|
-
rake (12.3.
|
11
|
-
test-unit (3.
|
9
|
+
power_assert (1.2.0)
|
10
|
+
rake (12.3.3)
|
11
|
+
test-unit (3.3.7)
|
12
12
|
power_assert
|
13
13
|
|
14
14
|
PLATFORMS
|
15
15
|
ruby
|
16
16
|
|
17
17
|
DEPENDENCIES
|
18
|
-
bundler (
|
18
|
+
bundler (>= 1.7, < 3.0)
|
19
19
|
rake (~> 12.3)
|
20
20
|
regexp-collection!
|
21
21
|
test-unit (~> 3.2)
|
22
22
|
|
23
23
|
BUNDLED WITH
|
24
|
-
1.
|
24
|
+
2.1.4
|
data/lib/regexp-collection.rb
CHANGED
@@ -16,4 +16,14 @@ module Regexp::Collection
|
|
16
16
|
self.natural_including_zero = /\A(?:0\z)|(?:\A[1-9]\d*)\z/.freeze
|
17
17
|
self.natural_excluding_zero = /\A[1-9]\d*\z/.freeze
|
18
18
|
end
|
19
|
+
|
20
|
+
module Time
|
21
|
+
class << self
|
22
|
+
attr_accessor :seconds_required, :seconds_not_permitted, :seconds_optional
|
23
|
+
end
|
24
|
+
|
25
|
+
self.seconds_required = /\A([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\z/.freeze
|
26
|
+
self.seconds_not_permitted = /\A([01]?[0-9]|2[0-3]):[0-5][0-9]\z/.freeze
|
27
|
+
self.seconds_optional = /\A([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?\z/.freeze
|
28
|
+
end
|
19
29
|
end
|
data/regexp-collection.gemspec
CHANGED
@@ -15,5 +15,5 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.files = `git ls-files -z`.split("\x0")
|
16
16
|
s.test_files = `git ls-files -z -- {test,spec,features}/*`.split("\x0")
|
17
17
|
s.require_paths = ["lib"]
|
18
|
-
s.add_development_dependency "bundler", "
|
18
|
+
s.add_development_dependency "bundler", ">= 1.7", "< 3.0"
|
19
19
|
end
|
@@ -112,4 +112,72 @@ class RegexpCollectionTest < Test::Unit::TestCase
|
|
112
112
|
assert_false "+1foo".match?(regexp)
|
113
113
|
assert_true "16".match?(regexp)
|
114
114
|
end
|
115
|
+
|
116
|
+
test "Time.seconds_required" do
|
117
|
+
regexp = Regexp::Collection::Time.seconds_required
|
118
|
+
assert_false "".match?(regexp)
|
119
|
+
assert_false "foo".match?(regexp)
|
120
|
+
assert_false "12".match?(regexp)
|
121
|
+
assert_false "12:11".match?(regexp)
|
122
|
+
assert_false "12:11:".match?(regexp)
|
123
|
+
assert_true "12:11:10".match?(regexp)
|
124
|
+
assert_false "+12:11:10".match?(regexp)
|
125
|
+
assert_false "12:11:10foo".match?(regexp)
|
126
|
+
assert_false "12:11:60".match?(regexp)
|
127
|
+
assert_true "23:59:59".match?(regexp)
|
128
|
+
assert_false "24:00:00".match?(regexp)
|
129
|
+
assert_false "1:00".match?(regexp)
|
130
|
+
assert_true "1:00:00".match?(regexp)
|
131
|
+
assert_false "01:00".match?(regexp)
|
132
|
+
assert_true "01:00:00".match?(regexp)
|
133
|
+
assert_false "12:0:0".match?(regexp)
|
134
|
+
assert_true "12:10:09".match?(regexp)
|
135
|
+
assert_false "12:10:09.111".match?(regexp)
|
136
|
+
end
|
137
|
+
|
138
|
+
test "Time.seconds_optional" do
|
139
|
+
regexp = Regexp::Collection::Time.seconds_optional
|
140
|
+
assert_false "".match?(regexp)
|
141
|
+
assert_false "foo".match?(regexp)
|
142
|
+
assert_false "12".match?(regexp)
|
143
|
+
assert_true "12:11".match?(regexp)
|
144
|
+
assert_false "12:11:".match?(regexp)
|
145
|
+
assert_true "12:11:10".match?(regexp)
|
146
|
+
assert_false "+12:11:10".match?(regexp)
|
147
|
+
assert_false "12:11:10foo".match?(regexp)
|
148
|
+
assert_false "12:11:60".match?(regexp)
|
149
|
+
assert_true "23:59".match?(regexp)
|
150
|
+
assert_true "23:59:59".match?(regexp)
|
151
|
+
assert_false "24:00:00".match?(regexp)
|
152
|
+
assert_true "1:00:00".match?(regexp)
|
153
|
+
assert_true "1:00".match?(regexp)
|
154
|
+
assert_true "01:00:00".match?(regexp)
|
155
|
+
assert_true "01:00".match?(regexp)
|
156
|
+
assert_false "12:0:0".match?(regexp)
|
157
|
+
assert_true "12:10:09".match?(regexp)
|
158
|
+
assert_false "12:10:09.111".match?(regexp)
|
159
|
+
end
|
160
|
+
|
161
|
+
test "Time.seconds_not_permitted" do
|
162
|
+
regexp = Regexp::Collection::Time.seconds_not_permitted
|
163
|
+
assert_false "".match?(regexp)
|
164
|
+
assert_false "foo".match?(regexp)
|
165
|
+
assert_false "12".match?(regexp)
|
166
|
+
assert_true "12:11".match?(regexp)
|
167
|
+
assert_false "12:11:".match?(regexp)
|
168
|
+
assert_false "12:11:10".match?(regexp)
|
169
|
+
assert_false "+12:11:10".match?(regexp)
|
170
|
+
assert_false "12:11:10foo".match?(regexp)
|
171
|
+
assert_false "12:11:60".match?(regexp)
|
172
|
+
assert_true "23:59".match?(regexp)
|
173
|
+
assert_false "23:59:59".match?(regexp)
|
174
|
+
assert_false "24:00:00".match?(regexp)
|
175
|
+
assert_false "1:00:00".match?(regexp)
|
176
|
+
assert_true "1:00".match?(regexp)
|
177
|
+
assert_false "01:00:00".match?(regexp)
|
178
|
+
assert_true "01:00".match?(regexp)
|
179
|
+
assert_false "12:0:0".match?(regexp)
|
180
|
+
assert_false "12:10:09".match?(regexp)
|
181
|
+
assert_false "12:10:09.111".match?(regexp)
|
182
|
+
end
|
115
183
|
end
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: regexp-collection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yaroslav Konoplov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.7'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3.0'
|
20
23
|
type: :development
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '1.7'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.0'
|
27
33
|
description: A gem providing pre-made and tested typical regular expressions for applications.
|
28
34
|
email: eahome00@gmail.com
|
29
35
|
executables: []
|
@@ -61,8 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
67
|
- !ruby/object:Gem::Version
|
62
68
|
version: '0'
|
63
69
|
requirements: []
|
64
|
-
|
65
|
-
rubygems_version: 2.7.6
|
70
|
+
rubygems_version: 3.1.2
|
66
71
|
signing_key:
|
67
72
|
specification_version: 4
|
68
73
|
summary: Regular expression collection for Ruby.
|