dsl_compose 2.2.1 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b5f53afb63b68aac27995b0fee8dceb7c0f5649a171f187bf95c85ebe29215e
|
4
|
+
data.tar.gz: 9ee378a6a342684339a0ff2472ed0aa37fb4d3a5e3e3f71f9eb9b87d5f013b37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f9494f1e9054d83bff8601aa6bf2c7e6fc887af2a7c3f762649d32d71116fa0c9856f1d94811df32246f7cf345eafdb06987946da9524832d2a8c9e366f4284
|
7
|
+
data.tar.gz: 42f04fe0ee1e3341716a446fd3747ba7bce072d921dcb2cf62ebe3a8d4e7112336ec3b5d42cd87c56076cbbaf36f29ccfe3925f1e1f13776d4d5a38f244f1b9f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [2.2.2](https://github.com/craigulliott/dsl_compose/compare/v2.2.1...v2.2.2) (2023-07-27)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* argument type :float was not accepting values and did not have validations ([243eff1](https://github.com/craigulliott/dsl_compose/commit/243eff1d0d0cc48602cc626e8a91cdc45b4f9955))
|
9
|
+
|
3
10
|
## [2.2.1](https://github.com/craigulliott/dsl_compose/compare/v2.2.0...v2.2.1) (2023-07-27)
|
4
11
|
|
5
12
|
|
@@ -362,6 +362,12 @@ module DSLCompose
|
|
362
362
|
(length_validation.nil? || length_validation.validate!(value))
|
363
363
|
end
|
364
364
|
|
365
|
+
# returns true if every provided float validation also returns true
|
366
|
+
def validate_float! value
|
367
|
+
# floats are validated with the same set of validators as integers
|
368
|
+
validate_integer! value
|
369
|
+
end
|
370
|
+
|
365
371
|
# returns true if every provided symbol validation also returns true
|
366
372
|
def validate_symbol! value
|
367
373
|
(format_validation.nil? || format_validation.validate!(value)) &&
|
@@ -51,7 +51,7 @@ module DSLCompose
|
|
51
51
|
# adds a new optional argument to the DSLMethod
|
52
52
|
#
|
53
53
|
# name must be a symbol
|
54
|
-
# `type` can be either :integer, :boolean, :float, :string or :
|
54
|
+
# `type` can be either :integer, :boolean, :float, :string, :symbol, :class or :object
|
55
55
|
# `block` contains the argument definition and will be evaluated seperately
|
56
56
|
# by the Argument::Interpreter
|
57
57
|
def optional name, type, array: false, &block
|
@@ -61,7 +61,7 @@ module DSLCompose
|
|
61
61
|
# adds a new required argument to the DSLMethod
|
62
62
|
#
|
63
63
|
# name must be a symbol
|
64
|
-
# `type` can be either :integer, :boolean, :float, :string or :
|
64
|
+
# `type` can be either :integer, :boolean, :float, :string, :symbol, :class or :object
|
65
65
|
# `block` contains the argument definition and will be evaluated seperately
|
66
66
|
# by the Argument::Interpreter
|
67
67
|
def requires name, type, array: false, &block
|
@@ -91,6 +91,13 @@ module DSLCompose
|
|
91
91
|
end
|
92
92
|
optional_argument.validate_integer! value
|
93
93
|
|
94
|
+
when :float
|
95
|
+
# float allows either floats or integers
|
96
|
+
unless value.is_a?(Float) || value.is_a?(Integer)
|
97
|
+
raise InvalidArgumentTypeError, "`#{value}` is not an Float or Integer"
|
98
|
+
end
|
99
|
+
optional_argument.validate_float! value
|
100
|
+
|
94
101
|
when :symbol
|
95
102
|
unless value.is_a? Symbol
|
96
103
|
raise InvalidArgumentTypeError, "`#{value}` is not a Symbol"
|
@@ -175,6 +182,13 @@ module DSLCompose
|
|
175
182
|
end
|
176
183
|
required_argument.validate_integer! value
|
177
184
|
|
185
|
+
when :float
|
186
|
+
# float allows either floats or integers
|
187
|
+
unless value.is_a?(Float) || value.is_a?(Integer)
|
188
|
+
raise InvalidArgumentTypeError, "`#{value}` is not an Float or Integer"
|
189
|
+
end
|
190
|
+
required_argument.validate_float! value
|
191
|
+
|
178
192
|
when :symbol
|
179
193
|
unless value.is_a? Symbol
|
180
194
|
raise InvalidArgumentTypeError, "`#{value}` is not a Symbol"
|
data/lib/dsl_compose/version.rb
CHANGED