strong_yaml 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/schema/config_boolean.rb +10 -0
- data/lib/schema/config_group.rb +5 -0
- data/lib/schema/schema.rb +5 -0
- data/lib/strong_yaml.rb +6 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e54353ed91ad9b10c4859e547f99ca8dca7908e1f659bc9fa13eee11a64cb993
|
4
|
+
data.tar.gz: ac074a8cae406b732fe684b2636d5f3d6a4b5d5660e6113257792498fe4c15ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b0039ef4d68b2fc929c495a5b81736aa121f9000f94257c31d9e1ef966e6518500585b069c606ab051f9b3c66aee0cdb8fdc88afacdeca8c78597a0dc9b02e0
|
7
|
+
data.tar.gz: 8739b8d2f444ae63d54c6d083d03daa12bc2d2f48670dbbc31dd2825957141ab282bd7e85f1f1ad383d44b2f1233c773a29d2176587ee0647a63a09bd39ca016
|
data/lib/schema/config_group.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require_relative "config_string"
|
2
2
|
require_relative "config_integer"
|
3
|
+
require_relative "config_boolean"
|
3
4
|
require_relative "config_list"
|
4
5
|
|
5
6
|
module StrongYAML
|
@@ -25,6 +26,10 @@ module StrongYAML
|
|
25
26
|
@elements << StrongYAML::ConfigInteger.new(name, **args)
|
26
27
|
end
|
27
28
|
|
29
|
+
def boolean(name, **args)
|
30
|
+
@elements << StrongYAML::ConfigBoolean.new(name, **args)
|
31
|
+
end
|
32
|
+
|
28
33
|
def list(name, **args)
|
29
34
|
@elements << StrongYAML::ConfigList.new(name, **args)
|
30
35
|
end
|
data/lib/schema/schema.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require_relative "config_group"
|
2
2
|
require_relative "config_string"
|
3
3
|
require_relative "config_integer"
|
4
|
+
require_relative "config_boolean"
|
4
5
|
require_relative "config_list"
|
5
6
|
|
6
7
|
module StrongYAML
|
@@ -28,6 +29,10 @@ module StrongYAML
|
|
28
29
|
@elements << StrongYAML::ConfigInteger.new(name, **args)
|
29
30
|
end
|
30
31
|
|
32
|
+
def boolean(name, **args)
|
33
|
+
@elements << StrongYAML::ConfigBoolean.new(name, **args)
|
34
|
+
end
|
35
|
+
|
31
36
|
def list(name, **args)
|
32
37
|
@elements << StrongYAML::ConfigList.new(name, **args)
|
33
38
|
end
|
data/lib/strong_yaml.rb
CHANGED
@@ -81,6 +81,12 @@ module StrongYAML
|
|
81
81
|
else
|
82
82
|
raise StrongYAML::ConfigSchema::SchemaError, "#{path.map(&:to_s).join(".")} is of type #{value.class}, but should be Integer"
|
83
83
|
end
|
84
|
+
when StrongYAML::ConfigBoolean
|
85
|
+
if value.nil? || !!value == value
|
86
|
+
value
|
87
|
+
else
|
88
|
+
raise StrongYAML::ConfigSchema::SchemaError, "#{path.map(&:to_s).join(".")} is of type #{value.class}, but should be Boolean"
|
89
|
+
end
|
84
90
|
when StrongYAML::ConfigList
|
85
91
|
if value.nil? || value.is_a?(Array)
|
86
92
|
value
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strong_yaml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philipp Schlesinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Allows for easy YAML parsing and type checking, as well as generators
|
14
14
|
email:
|
@@ -17,6 +17,7 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- lib/schema/config_boolean.rb
|
20
21
|
- lib/schema/config_group.rb
|
21
22
|
- lib/schema/config_integer.rb
|
22
23
|
- lib/schema/config_list.rb
|