dsl_compose 1.8.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +8 -8
- data/lib/dsl_compose/dsl/arguments/argument/end_with_validation.rb +16 -5
- data/lib/dsl_compose/dsl/arguments/argument/not_end_with_validation.rb +16 -5
- data/lib/dsl_compose/dsl/arguments/argument/not_start_with_validation.rb +16 -5
- data/lib/dsl_compose/dsl/arguments/argument/start_with_validation.rb +16 -5
- data/lib/dsl_compose/dsl/arguments/argument.rb +4 -4
- data/lib/dsl_compose/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44f916259ac32c44bb38f5c8a423d6e41f9c3b61604715bb1e550b1ab9f5dc64
|
4
|
+
data.tar.gz: 22a2303459feb386ac8fa0995323fa95001d2312e83d90271d0868f66cf69e82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcf694293406ec2b317da5a9ea7f9fcfac87efae1ecd8cf481e27325d916b61ffdb23b54909589d01cdbb2e30d1fc612c5f6bd7d6e1618e2db937bf97c43f052
|
7
|
+
data.tar.gz: a50c27fe9ffab7b47326c1e4826983fe0bcec1428fed0f2d5d7e0b54d928e5c592cba2d8973b88f11e08bcc295f50a6def76058de086d97fd14f98273c656019
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [1.9.0](https://github.com/craigulliott/dsl_compose/compare/v1.8.0...v1.9.0) (2023-07-11)
|
4
|
+
|
5
|
+
|
6
|
+
### Features
|
7
|
+
|
8
|
+
* start_with, not_start_with, end_with and not_end_with validators now accept an array of values to test against ([#23](https://github.com/craigulliott/dsl_compose/issues/23)) ([cddcb4b](https://github.com/craigulliott/dsl_compose/commit/cddcb4b629499e3af0d71cc27f5c2f1dd8ae76d5))
|
9
|
+
|
3
10
|
## [1.8.0](https://github.com/craigulliott/dsl_compose/compare/v1.7.0...v1.8.0) (2023-07-11)
|
4
11
|
|
5
12
|
|
data/README.md
CHANGED
@@ -293,16 +293,16 @@ The following validations can be added to the arguments of your DSL methods. Val
|
|
293
293
|
validate_in ["cat", "dog"]
|
294
294
|
|
295
295
|
# The argument must start with the following string.
|
296
|
-
validate_start_with [
|
296
|
+
validate_start_with [:foo_]
|
297
297
|
|
298
298
|
# The argument must not start with the following string.
|
299
|
-
validate_not_start_with [
|
299
|
+
validate_not_start_with [:foo_]
|
300
300
|
|
301
301
|
# The argument must end with the following string.
|
302
|
-
validate_end_with [
|
302
|
+
validate_end_with [:_foo]
|
303
303
|
|
304
304
|
# The argument must not end with the following string.
|
305
|
-
validate_not_end_with [
|
305
|
+
validate_not_end_with [:_foo]
|
306
306
|
|
307
307
|
# The argument must match the provided regex.
|
308
308
|
validate_format /\A[A-Z][a-z]+\Z/
|
@@ -340,16 +340,16 @@ The following validations can be added to the arguments of your DSL methods. Val
|
|
340
340
|
validate_in [:cat, :dog]
|
341
341
|
|
342
342
|
# The argument must start with the following string.
|
343
|
-
validate_start_with [
|
343
|
+
validate_start_with [:foo_]
|
344
344
|
|
345
345
|
# The argument must not start with the following string.
|
346
|
-
validate_not_start_with [
|
346
|
+
validate_not_start_with [:foo_]
|
347
347
|
|
348
348
|
# The argument must end with the following string.
|
349
|
-
validate_end_with [
|
349
|
+
validate_end_with [:_foo]
|
350
350
|
|
351
351
|
# The argument must not end with the following string.
|
352
|
-
validate_not_end_with [
|
352
|
+
validate_not_end_with [:_foo]
|
353
353
|
|
354
354
|
# The argument must match the provided regex.
|
355
355
|
validate_format /\A[A-Z][a-z]+\Z/
|
@@ -11,16 +11,27 @@ module DSLCompose
|
|
11
11
|
class ValidationFailedError < StandardError
|
12
12
|
end
|
13
13
|
|
14
|
-
def initialize
|
15
|
-
|
16
|
-
|
14
|
+
def initialize values
|
15
|
+
# if the provided values is a symbol, then convert it to an array
|
16
|
+
if values.is_a? Symbol
|
17
|
+
values = [values]
|
17
18
|
end
|
18
19
|
|
19
|
-
|
20
|
+
# assert that the provided values is an array
|
21
|
+
unless values.is_a? Array
|
22
|
+
raise ValidationFailedError, "The value `#{values}` provided to this validator must be a Symbol or an Array of Symbols"
|
23
|
+
end
|
24
|
+
|
25
|
+
# assert that the provided values is an array of symbols
|
26
|
+
unless values.all? { |value| value.is_a? Symbol }
|
27
|
+
raise ValidationFailedError, "The value `#{values}` provided to this validator must be a Symbol or an Array of Symbols"
|
28
|
+
end
|
29
|
+
|
30
|
+
@values = values
|
20
31
|
end
|
21
32
|
|
22
33
|
def validate! value
|
23
|
-
raise ValidationFailedError, "The argument is invalid. Expected `#{value}` to end with `#{@
|
34
|
+
raise ValidationFailedError, "The argument is invalid. Expected `#{value}` to end with `#{@values}`" unless @values.filter { |v| value.end_with? v.to_s }.any?
|
24
35
|
true
|
25
36
|
end
|
26
37
|
end
|
@@ -11,16 +11,27 @@ module DSLCompose
|
|
11
11
|
class ValidationFailedError < StandardError
|
12
12
|
end
|
13
13
|
|
14
|
-
def initialize
|
15
|
-
|
16
|
-
|
14
|
+
def initialize values
|
15
|
+
# if the provided values is a symbol, then convert it to an array
|
16
|
+
if values.is_a? Symbol
|
17
|
+
values = [values]
|
17
18
|
end
|
18
19
|
|
19
|
-
|
20
|
+
# assert that the provided values is an array
|
21
|
+
unless values.is_a? Array
|
22
|
+
raise ValidationFailedError, "The value `#{values}` provided to this validator must be a Symbol or an Array of Symbols"
|
23
|
+
end
|
24
|
+
|
25
|
+
# assert that the provided values is an array of symbols
|
26
|
+
unless values.all? { |value| value.is_a? Symbol }
|
27
|
+
raise ValidationFailedError, "The value `#{values}` provided to this validator must be a Symbol or an Array of Symbols"
|
28
|
+
end
|
29
|
+
|
30
|
+
@values = values
|
20
31
|
end
|
21
32
|
|
22
33
|
def validate! value
|
23
|
-
raise ValidationFailedError, "The argument is invalid. Expected `#{value}` to not end with `#{@
|
34
|
+
raise ValidationFailedError, "The argument is invalid. Expected `#{value}` to not end with `#{@values}`" if @values.filter { |v| value.end_with? v.to_s }.any?
|
24
35
|
true
|
25
36
|
end
|
26
37
|
end
|
@@ -11,16 +11,27 @@ module DSLCompose
|
|
11
11
|
class ValidationFailedError < StandardError
|
12
12
|
end
|
13
13
|
|
14
|
-
def initialize
|
15
|
-
|
16
|
-
|
14
|
+
def initialize values
|
15
|
+
# if the provided values is a symbol, then convert it to an array
|
16
|
+
if values.is_a? Symbol
|
17
|
+
values = [values]
|
17
18
|
end
|
18
19
|
|
19
|
-
|
20
|
+
# assert that the provided values is an array
|
21
|
+
unless values.is_a? Array
|
22
|
+
raise ValidationFailedError, "The value `#{values}` provided to this validator must be a Symbol or an Array of Symbols"
|
23
|
+
end
|
24
|
+
|
25
|
+
# assert that the provided values is an array of symbols
|
26
|
+
unless values.all? { |value| value.is_a? Symbol }
|
27
|
+
raise ValidationFailedError, "The value `#{values}` provided to this validator must be a Symbol or an Array of Symbols"
|
28
|
+
end
|
29
|
+
|
30
|
+
@values = values
|
20
31
|
end
|
21
32
|
|
22
33
|
def validate! value
|
23
|
-
raise ValidationFailedError, "The argument is invalid. Expected `#{value}` to not start with `#{@
|
34
|
+
raise ValidationFailedError, "The argument is invalid. Expected `#{value}` to not start with `#{@values}`" if @values.filter { |v| value.start_with? v.to_s }.any?
|
24
35
|
true
|
25
36
|
end
|
26
37
|
end
|
@@ -11,16 +11,27 @@ module DSLCompose
|
|
11
11
|
class ValidationFailedError < StandardError
|
12
12
|
end
|
13
13
|
|
14
|
-
def initialize
|
15
|
-
|
16
|
-
|
14
|
+
def initialize values
|
15
|
+
# if the provided values is a symbol, then convert it to an array
|
16
|
+
if values.is_a? Symbol
|
17
|
+
values = [values]
|
17
18
|
end
|
18
19
|
|
19
|
-
|
20
|
+
# assert that the provided values is an array
|
21
|
+
unless values.is_a? Array
|
22
|
+
raise ValidationFailedError, "The value `#{values}` provided to this validator must be a Symbol or an Array of Symbols"
|
23
|
+
end
|
24
|
+
|
25
|
+
# assert that the provided values is an array of symbols
|
26
|
+
unless values.all? { |value| value.is_a? Symbol }
|
27
|
+
raise ValidationFailedError, "The value `#{values}` provided to this validator must be a Symbol or an Array of Symbols"
|
28
|
+
end
|
29
|
+
|
30
|
+
@values = values
|
20
31
|
end
|
21
32
|
|
22
33
|
def validate! value
|
23
|
-
raise ValidationFailedError, "The argument is invalid. Expected `#{value}` to start with `#{@
|
34
|
+
raise ValidationFailedError, "The argument is invalid. Expected `#{value}` to start with `#{@values}`" unless @values.filter { |v| value.start_with? v.to_s }.any?
|
24
35
|
true
|
25
36
|
end
|
26
37
|
end
|
@@ -260,7 +260,7 @@ module DSLCompose
|
|
260
260
|
raise ValidationAlreadyExistsError, "The validation `end_with` has already been applied to this method option."
|
261
261
|
end
|
262
262
|
|
263
|
-
unless value.is_a?
|
263
|
+
unless value.is_a? Symbol
|
264
264
|
raise ValidationInvalidArgumentError, value
|
265
265
|
end
|
266
266
|
|
@@ -276,7 +276,7 @@ module DSLCompose
|
|
276
276
|
raise ValidationAlreadyExistsError, "The validation `not_end_with` has already been applied to this method option."
|
277
277
|
end
|
278
278
|
|
279
|
-
unless value.is_a?
|
279
|
+
unless value.is_a? Symbol
|
280
280
|
raise ValidationInvalidArgumentError, value
|
281
281
|
end
|
282
282
|
|
@@ -292,7 +292,7 @@ module DSLCompose
|
|
292
292
|
raise ValidationAlreadyExistsError, "The validation `start_with` has already been applied to this method option."
|
293
293
|
end
|
294
294
|
|
295
|
-
unless value.is_a?
|
295
|
+
unless value.is_a? Symbol
|
296
296
|
raise ValidationInvalidArgumentError, value
|
297
297
|
end
|
298
298
|
|
@@ -308,7 +308,7 @@ module DSLCompose
|
|
308
308
|
raise ValidationAlreadyExistsError, "The validation `not_start_with` has already been applied to this method option."
|
309
309
|
end
|
310
310
|
|
311
|
-
unless value.is_a?
|
311
|
+
unless value.is_a? Symbol
|
312
312
|
raise ValidationInvalidArgumentError, value
|
313
313
|
end
|
314
314
|
|
data/lib/dsl_compose/version.rb
CHANGED