schemacop 2.4.5 → 2.4.6

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: dfdf6387da274755f11337c9eef5796464319644fab1f2a8fe32470de96bf0b7
4
- data.tar.gz: 0f6c49016149ab3828158ca78b57756e4383dadb428a2748541596b4db065e38
3
+ metadata.gz: 20424213f11e658be2843c1de6fb401282366aacaaeaabc44ea59a5702450c0a
4
+ data.tar.gz: 324b171945481c70eaf990fc2bd415924006580452adf401dbd4cb31be64f246
5
5
  SHA512:
6
- metadata.gz: bd2a8f01688886428a0bb67420f1a8e943923a05e0f311b65d479b10a82270a6d50816b5f20aef3674085b8343b19dc6da9d5568d230be927dd36990a3fb0e8b
7
- data.tar.gz: 89fb45cd8890947b0e429cd3e02cbb16d3cb8a8fc0f8859025a60f1d7694b13f6bbb7bf5157f32a7a01c63634804380a83a24af93e161a7ef7a8d6e2498174eb
6
+ metadata.gz: 8074c7fa98e9a20ceb7215299a11383653130f646a9373a9e9bdf5cc1278b0367820196f78a510b209dd8da72315b888ed3bace7aad3e84149a2732e91de5889
7
+ data.tar.gz: 28760f0e430a1c593762e25f3884a6b35761190420bf4e9f40584adb18dff4f4a45521e624e2918f40040805c2f52d74ba9ffd82c5af0ea4382f7f90196488a0
@@ -10,7 +10,11 @@
10
10
  ### Changes
11
11
  -->
12
12
 
13
- ## 2.4.4 (2020-05-13)
13
+ ## 2.4.6 (2020-06-29)
14
+
15
+ * Use basis 10 (decimal system) when casting a `String` to an `Integer`
16
+
17
+ ## 2.4.5 (2020-05-13)
14
18
 
15
19
  * Allow procs for `default` that will be evaluated at runtime
16
20
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.4.5
1
+ 2.4.6
@@ -111,7 +111,7 @@
111
111
  </dt>
112
112
  <dd><pre class="code"><span class='lbrace'>{</span>
113
113
  <span class='const'>String</span> <span class='op'>=&gt;</span> <span class='lbrace'>{</span>
114
- <span class='const'>Integer</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_proc'>proc</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span> <span class='const'>Integer</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='comma'>,</span>
114
+ <span class='const'>Integer</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_proc'>proc</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span> <span class='const'>Integer</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='comma'>,</span> <span class='int'>10</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='comma'>,</span>
115
115
  <span class='const'>Float</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_proc'>proc</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span> <span class='const'>Float</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
116
116
  <span class='rbrace'>}</span><span class='comma'>,</span>
117
117
  <span class='const'>Float</span> <span class='op'>=&gt;</span> <span class='lbrace'>{</span>
@@ -136,7 +136,7 @@
136
136
  </div>
137
137
 
138
138
  <div id="footer">
139
- Generated on Wed May 13 10:52:04 2020 by
139
+ Generated on Mon Jun 29 17:18:17 2020 by
140
140
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
141
141
  0.9.20 (ruby-2.6.2).
142
142
  </div>
@@ -319,7 +319,7 @@
319
319
  </div>
320
320
 
321
321
  <div id="footer">
322
- Generated on Wed May 13 10:52:04 2020 by
322
+ Generated on Mon Jun 29 17:18:17 2020 by
323
323
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
324
324
  0.9.20 (ruby-2.6.2).
325
325
  </div>
@@ -135,7 +135,7 @@
135
135
  </div>
136
136
 
137
137
  <div id="footer">
138
- Generated on Wed May 13 10:52:04 2020 by
138
+ Generated on Mon Jun 29 17:18:17 2020 by
139
139
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
140
140
  0.9.20 (ruby-2.6.2).
141
141
  </div>
@@ -369,7 +369,7 @@
369
369
  </div>
370
370
 
371
371
  <div id="footer">
372
- Generated on Wed May 13 10:52:04 2020 by
372
+ Generated on Mon Jun 29 17:18:17 2020 by
373
373
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
374
374
  0.9.20 (ruby-2.6.2).
375
375
  </div>
@@ -777,7 +777,7 @@ called.

777
777
  </div>
778
778
 
779
779
  <div id="footer">
780
- Generated on Wed May 13 10:52:04 2020 by
780
+ Generated on Mon Jun 29 17:18:17 2020 by
781
781
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
782
782
  0.9.20 (ruby-2.6.2).
783
783
  </div>
@@ -204,7 +204,7 @@
204
204
  </div>
205
205
 
206
206
  <div id="footer">
207
- Generated on Wed May 13 10:52:04 2020 by
207
+ Generated on Mon Jun 29 17:18:17 2020 by
208
208
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
209
209
  0.9.20 (ruby-2.6.2).
210
210
  </div>
@@ -105,7 +105,7 @@
105
105
  </div>
106
106
 
107
107
  <div id="footer">
108
- Generated on Wed May 13 10:52:04 2020 by
108
+ Generated on Mon Jun 29 17:18:17 2020 by
109
109
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
110
110
  0.9.20 (ruby-2.6.2).
111
111
  </div>
@@ -114,7 +114,7 @@
114
114
  </div>
115
115
 
116
116
  <div id="footer">
117
- Generated on Wed May 13 10:52:04 2020 by
117
+ Generated on Mon Jun 29 17:18:17 2020 by
118
118
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
119
119
  0.9.20 (ruby-2.6.2).
120
120
  </div>
@@ -114,7 +114,7 @@
114
114
  </div>
115
115
 
116
116
  <div id="footer">
117
- Generated on Wed May 13 10:52:04 2020 by
117
+ Generated on Mon Jun 29 17:18:17 2020 by
118
118
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
119
119
  0.9.20 (ruby-2.6.2).
120
120
  </div>
@@ -411,7 +411,7 @@
411
411
  </div>
412
412
 
413
413
  <div id="footer">
414
- Generated on Wed May 13 10:52:04 2020 by
414
+ Generated on Mon Jun 29 17:18:17 2020 by
415
415
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
416
416
  0.9.20 (ruby-2.6.2).
417
417
  </div>
@@ -148,7 +148,7 @@
148
148
  </div>
149
149
 
150
150
  <div id="footer">
151
- Generated on Wed May 13 10:52:04 2020 by
151
+ Generated on Mon Jun 29 17:18:17 2020 by
152
152
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
153
153
  0.9.20 (ruby-2.6.2).
154
154
  </div>
@@ -283,7 +283,7 @@
283
283
  </div>
284
284
 
285
285
  <div id="footer">
286
- Generated on Wed May 13 10:52:04 2020 by
286
+ Generated on Mon Jun 29 17:18:17 2020 by
287
287
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
288
288
  0.9.20 (ruby-2.6.2).
289
289
  </div>
@@ -148,7 +148,7 @@
148
148
  </div>
149
149
 
150
150
  <div id="footer">
151
- Generated on Wed May 13 10:52:04 2020 by
151
+ Generated on Mon Jun 29 17:18:17 2020 by
152
152
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
153
153
  0.9.20 (ruby-2.6.2).
154
154
  </div>
@@ -135,7 +135,7 @@
135
135
  </div>
136
136
 
137
137
  <div id="footer">
138
- Generated on Wed May 13 10:52:04 2020 by
138
+ Generated on Mon Jun 29 17:18:17 2020 by
139
139
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
140
140
  0.9.20 (ruby-2.6.2).
141
141
  </div>
@@ -1428,7 +1428,7 @@
1428
1428
  </div>
1429
1429
 
1430
1430
  <div id="footer">
1431
- Generated on Wed May 13 10:52:04 2020 by
1431
+ Generated on Mon Jun 29 17:18:17 2020 by
1432
1432
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1433
1433
  0.9.20 (ruby-2.6.2).
1434
1434
  </div>
@@ -248,7 +248,7 @@
248
248
  </div>
249
249
 
250
250
  <div id="footer">
251
- Generated on Wed May 13 10:52:04 2020 by
251
+ Generated on Mon Jun 29 17:18:17 2020 by
252
252
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
253
253
  0.9.20 (ruby-2.6.2).
254
254
  </div>
@@ -580,7 +580,7 @@
580
580
  </div>
581
581
 
582
582
  <div id="footer">
583
- Generated on Wed May 13 10:52:04 2020 by
583
+ Generated on Mon Jun 29 17:18:17 2020 by
584
584
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
585
585
  0.9.20 (ruby-2.6.2).
586
586
  </div>
@@ -602,7 +602,7 @@ as it formerly was the case in the constructor.

602
602
  </div>
603
603
 
604
604
  <div id="footer">
605
- Generated on Wed May 13 10:52:04 2020 by
605
+ Generated on Mon Jun 29 17:18:17 2020 by
606
606
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
607
607
  0.9.20 (ruby-2.6.2).
608
608
  </div>
@@ -279,7 +279,7 @@
279
279
  </div>
280
280
 
281
281
  <div id="footer">
282
- Generated on Wed May 13 10:52:04 2020 by
282
+ Generated on Mon Jun 29 17:18:17 2020 by
283
283
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
284
284
  0.9.20 (ruby-2.6.2).
285
285
  </div>
@@ -222,7 +222,7 @@
222
222
  </div>
223
223
 
224
224
  <div id="footer">
225
- Generated on Wed May 13 10:52:04 2020 by
225
+ Generated on Mon Jun 29 17:18:17 2020 by
226
226
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
227
227
  0.9.20 (ruby-2.6.2).
228
228
  </div>
@@ -288,7 +288,7 @@
288
288
  </div>
289
289
 
290
290
  <div id="footer">
291
- Generated on Wed May 13 10:52:04 2020 by
291
+ Generated on Mon Jun 29 17:18:17 2020 by
292
292
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
293
293
  0.9.20 (ruby-2.6.2).
294
294
  </div>
@@ -161,7 +161,7 @@
161
161
  </div>
162
162
 
163
163
  <div id="footer">
164
- Generated on Wed May 13 10:52:04 2020 by
164
+ Generated on Mon Jun 29 17:18:17 2020 by
165
165
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
166
166
  0.9.20 (ruby-2.6.2).
167
167
  </div>
@@ -689,7 +689,7 @@ this exception is thrown.

689
689
  </div>
690
690
 
691
691
  <div id="footer">
692
- Generated on Wed May 13 10:52:04 2020 by
692
+ Generated on Mon Jun 29 17:18:17 2020 by
693
693
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
694
694
  0.9.20 (ruby-2.6.2).
695
695
  </div>
@@ -285,7 +285,7 @@
285
285
  </div>
286
286
 
287
287
  <div id="footer">
288
- Generated on Wed May 13 10:52:04 2020 by
288
+ Generated on Mon Jun 29 17:18:17 2020 by
289
289
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
290
290
  0.9.20 (ruby-2.6.2).
291
291
  </div>
@@ -135,7 +135,7 @@
135
135
  </div>
136
136
 
137
137
  <div id="footer">
138
- Generated on Wed May 13 10:52:04 2020 by
138
+ Generated on Mon Jun 29 17:18:17 2020 by
139
139
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
140
140
  0.9.20 (ruby-2.6.2).
141
141
  </div>
@@ -341,7 +341,7 @@
341
341
  </div>
342
342
 
343
343
  <div id="footer">
344
- Generated on Wed May 13 10:52:04 2020 by
344
+ Generated on Mon Jun 29 17:18:17 2020 by
345
345
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
346
346
  0.9.20 (ruby-2.6.2).
347
347
  </div>
@@ -369,7 +369,7 @@
369
369
  </div>
370
370
 
371
371
  <div id="footer">
372
- Generated on Wed May 13 10:52:04 2020 by
372
+ Generated on Mon Jun 29 17:18:17 2020 by
373
373
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
374
374
  0.9.20 (ruby-2.6.2).
375
375
  </div>
@@ -823,7 +823,7 @@ file

823
823
  </div></div>
824
824
 
825
825
  <div id="footer">
826
- Generated on Wed May 13 10:52:04 2020 by
826
+ Generated on Mon Jun 29 17:18:17 2020 by
827
827
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
828
828
  0.9.20 (ruby-2.6.2).
829
829
  </div>
@@ -823,7 +823,7 @@ file

823
823
  </div></div>
824
824
 
825
825
  <div id="footer">
826
- Generated on Wed May 13 10:52:04 2020 by
826
+ Generated on Mon Jun 29 17:18:17 2020 by
827
827
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
828
828
  0.9.20 (ruby-2.6.2).
829
829
  </div>
@@ -102,7 +102,7 @@
102
102
  </div>
103
103
 
104
104
  <div id="footer">
105
- Generated on Wed May 13 10:52:04 2020 by
105
+ Generated on Mon Jun 29 17:18:17 2020 by
106
106
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
107
107
  0.9.20 (ruby-2.6.2).
108
108
  </div>
@@ -1,7 +1,7 @@
1
1
  module Schemacop
2
2
  DEFAULT_CASTERS = {
3
3
  String => {
4
- Integer => proc { |s| Integer(s) },
4
+ Integer => proc { |s| Integer(s, 10) },
5
5
  Float => proc { |s| Float(s) }
6
6
  },
7
7
  Float => {
@@ -105,12 +105,12 @@ module Schemacop
105
105
 
106
106
  next unless caster.castable?
107
107
  begin
108
- data = caster.cast
109
- collector.override_value(data)
110
- return data
111
- rescue Exceptions::InvalidSchemaError => e
112
- collector.error e.message
113
- end
108
+ data = caster.cast
109
+ collector.override_value(data)
110
+ return data
111
+ rescue Exceptions::InvalidSchemaError => e
112
+ collector.error e.message
113
+ end
114
114
  end
115
115
 
116
116
  return data
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: schemacop 2.4.5 ruby lib
2
+ # stub: schemacop 2.4.6 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "schemacop".freeze
6
- s.version = "2.4.5"
6
+ s.version = "2.4.6"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
10
10
  s.authors = ["Sitrox".freeze]
11
- s.date = "2020-05-13"
11
+ s.date = "2020-06-29"
12
12
  s.files = [".gitignore".freeze, ".releaser_config".freeze, ".rubocop.yml".freeze, ".travis.yml".freeze, ".yardopts".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "RUBY_VERSION".freeze, "Rakefile".freeze, "VERSION".freeze, "doc/Schemacop.html".freeze, "doc/Schemacop/ArrayValidator.html".freeze, "doc/Schemacop/BooleanValidator.html".freeze, "doc/Schemacop/Caster.html".freeze, "doc/Schemacop/Collector.html".freeze, "doc/Schemacop/Dupper.html".freeze, "doc/Schemacop/Exceptions.html".freeze, "doc/Schemacop/Exceptions/InvalidSchemaError.html".freeze, "doc/Schemacop/Exceptions/ValidationError.html".freeze, "doc/Schemacop/FieldNode.html".freeze, "doc/Schemacop/FloatValidator.html".freeze, "doc/Schemacop/HashValidator.html".freeze, "doc/Schemacop/IntegerValidator.html".freeze, "doc/Schemacop/NilValidator.html".freeze, "doc/Schemacop/Node.html".freeze, "doc/Schemacop/NodeResolver.html".freeze, "doc/Schemacop/NodeSupportingField.html".freeze, "doc/Schemacop/NodeSupportingType.html".freeze, "doc/Schemacop/NodeWithBlock.html".freeze, "doc/Schemacop/NumberValidator.html".freeze, "doc/Schemacop/ObjectValidator.html".freeze, "doc/Schemacop/RootNode.html".freeze, "doc/Schemacop/Schema.html".freeze, "doc/Schemacop/StringValidator.html".freeze, "doc/Schemacop/SymbolValidator.html".freeze, "doc/ScopedEnv.html".freeze, "doc/_index.html".freeze, "doc/class_list.html".freeze, "doc/css/common.css".freeze, "doc/css/full_list.css".freeze, "doc/css/style.css".freeze, "doc/file.README.html".freeze, "doc/file_list.html".freeze, "doc/frames.html".freeze, "doc/index.html".freeze, "doc/inheritance.graphml".freeze, "doc/inheritance.pdf".freeze, "doc/js/app.js".freeze, "doc/js/full_list.js".freeze, "doc/js/jquery.js".freeze, "doc/method_list.html".freeze, "doc/top-level-namespace.html".freeze, "lib/schemacop.rb".freeze, "lib/schemacop/caster.rb".freeze, "lib/schemacop/collector.rb".freeze, "lib/schemacop/dupper.rb".freeze, "lib/schemacop/exceptions.rb".freeze, "lib/schemacop/field_node.rb".freeze, "lib/schemacop/node.rb".freeze, "lib/schemacop/node_resolver.rb".freeze, "lib/schemacop/node_supporting_field.rb".freeze, "lib/schemacop/node_supporting_type.rb".freeze, "lib/schemacop/node_with_block.rb".freeze, "lib/schemacop/root_node.rb".freeze, "lib/schemacop/schema.rb".freeze, "lib/schemacop/scoped_env.rb".freeze, "lib/schemacop/validator/array_validator.rb".freeze, "lib/schemacop/validator/boolean_validator.rb".freeze, "lib/schemacop/validator/float_validator.rb".freeze, "lib/schemacop/validator/hash_validator.rb".freeze, "lib/schemacop/validator/integer_validator.rb".freeze, "lib/schemacop/validator/nil_validator.rb".freeze, "lib/schemacop/validator/number_validator.rb".freeze, "lib/schemacop/validator/object_validator.rb".freeze, "lib/schemacop/validator/string_validator.rb".freeze, "lib/schemacop/validator/symbol_validator.rb".freeze, "schemacop.gemspec".freeze, "test/casting_test.rb".freeze, "test/collector_test.rb".freeze, "test/custom_check_test.rb".freeze, "test/custom_if_test.rb".freeze, "test/defaults_test.rb".freeze, "test/empty_test.rb".freeze, "test/nil_dis_allow_test.rb".freeze, "test/node_resolver_test.rb".freeze, "test/short_forms_test.rb".freeze, "test/test_helper.rb".freeze, "test/types_test.rb".freeze, "test/validator_array_test.rb".freeze, "test/validator_boolean_test.rb".freeze, "test/validator_float_test.rb".freeze, "test/validator_hash_test.rb".freeze, "test/validator_integer_test.rb".freeze, "test/validator_nil_test.rb".freeze, "test/validator_number_test.rb".freeze, "test/validator_object_test.rb".freeze, "test/validator_string_test.rb".freeze, "test/validator_symbol_test.rb".freeze]
13
13
  s.homepage = "https://github.com/sitrox/schemacop".freeze
14
14
  s.licenses = ["MIT".freeze]
@@ -86,5 +86,15 @@ module Schemacop
86
86
 
87
87
  assert_equal 42, s.validate!('42')
88
88
  end
89
+
90
+ def test_decimal_basis_castings
91
+ s = Schema.new do
92
+ type :integer, cast: [String]
93
+ end
94
+
95
+ assert_equal 1, s.validate!('01')
96
+ assert_equal 8, s.validate!('08')
97
+ assert_equal 11, s.validate!('011')
98
+ end
89
99
  end
90
100
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schemacop
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.5
4
+ version: 2.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sitrox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-13 00:00:00.000000000 Z
11
+ date: 2020-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport