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: dc5d05054343d31af8700ec10104ef0040615583c026d5588354888092670e63
4
- data.tar.gz: a211ab077787f947eb2337a727c516e600903b6ec5dd4dc4650d3cb16aa264bc
3
+ metadata.gz: 1b5f53afb63b68aac27995b0fee8dceb7c0f5649a171f187bf95c85ebe29215e
4
+ data.tar.gz: 9ee378a6a342684339a0ff2472ed0aa37fb4d3a5e3e3f71f9eb9b87d5f013b37
5
5
  SHA512:
6
- metadata.gz: 438b429f3fd729f655b474c9d23a4224e41e66d6bcbfd32bf227607772a83c54a5400cb7e5dbdc947a101240ee43f8656fb1f7c4798e0a3c4218679090db00d3
7
- data.tar.gz: 8717ba33401dcc579de9de6bb6132263ba1737e87b8820874cc5e1d161651bdffe1481d3f676fb10d1ffef8da254eaaea95a83e1c1bccc58cc16b9511428efc5
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 :symbol
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 :symbol
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"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DSLCompose
4
- VERSION = "2.2.1"
4
+ VERSION = "2.2.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dsl_compose
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig Ulliott