simple-config 0.6.3 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data/lib/simple-config.rb +31 -3
- data.tar.gz.sig +0 -0
- metadata +32 -28
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f31bf5d219d6041190571af4825c8b6453c961ed5a564d91ed44ba1d51c98bfc
|
4
|
+
data.tar.gz: 24dff310f8873c6d7981cc73c190d7b35f1034b40e86cb04e5db3807a27638ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c58ce83f8700841ee34bf89d2858a6abba6c4d6869c70600f76c7d7d6ed113cfd3b3266472a54e91740881dbee843ce68e5ea0203d30ed39b6291c9f832431f8
|
7
|
+
data.tar.gz: 6395327c2c0e08afd2ec5b0900cd16510ab43789ddc5a7524d0d4fdeb2c9e2f7e18c5f57089a8e9c3a51be8231c5d1cf122ada990b88fb8160d5234becaf4881
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/simple-config.rb
CHANGED
@@ -8,12 +8,15 @@ require 'kvx'
|
|
8
8
|
class SimpleConfig < Kvx
|
9
9
|
|
10
10
|
|
11
|
-
def initialize(x, attributes: {})
|
11
|
+
def initialize(x, attributes: {}, auto_detect_type: true, debug: false)
|
12
12
|
|
13
|
+
@ignore_blank_lines = true
|
14
|
+
@auto_detect_type = auto_detect_type
|
15
|
+
|
13
16
|
if x.is_a? SimpleConfig then
|
14
17
|
@to_h = x.to_h
|
15
18
|
elsif x
|
16
|
-
super(x, attributes: attributes)
|
19
|
+
super(x, attributes: attributes, debug: debug)
|
17
20
|
end
|
18
21
|
|
19
22
|
@identifier = 'simple-config'
|
@@ -25,8 +28,33 @@ class SimpleConfig < Kvx
|
|
25
28
|
private
|
26
29
|
|
27
30
|
def parse_to_h(s)
|
28
|
-
super(s, header_pattern: %r(^<\?simple-?config\s*))
|
31
|
+
h = super(s, header_pattern: %r(^<\?simple-?config\s*))
|
32
|
+
@auto_detect_type ? scan2type(h) : h
|
29
33
|
end
|
34
|
+
|
35
|
+
def find_type(v)
|
36
|
+
|
37
|
+
puts 'v: ' + v.inspect if @debug
|
38
|
+
|
39
|
+
if v[/^\d+$/] and v.to_i.to_s.length == v.length then v.to_i
|
40
|
+
elsif v[/^\d+\.\d+$/] and v.to_f.to_s.length == v.length then v.to_f
|
41
|
+
elsif v.downcase[/^(?:true|false|on|off|yes|no)$/]
|
42
|
+
v.downcase[/^(?:true|on|yes)$/] ? true : false
|
43
|
+
elsif v[/^\#.*\#$/] then
|
44
|
+
Time.parse(v)
|
45
|
+
else
|
46
|
+
v
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
def scan2type(h)
|
52
|
+
|
53
|
+
h.each do |key, value|
|
54
|
+
next if value.is_a? Array
|
55
|
+
h[key] = value.is_a?(Hash) ? scan2type(value) : find_type(value)
|
56
|
+
end
|
30
57
|
|
58
|
+
end
|
31
59
|
|
32
60
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,28 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|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mV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEArtfxuF7dBNlgu3vPZAxJoKYLimwoRUloSZbk1FVI
|
29
|
+
BcWe+ARt8Fb8SWZE7qGtJP5s4YLPwQx/wn5fZKAX0uDL0bQoAuabbCSBavJQOeCT
|
30
|
+
Xn0goovz1d2GsDD+bNfgaQyvf0uL3f2a0UFglbecmxO39juGLZ54Uy4QZGqFYSUr
|
31
|
+
sEaGnqQ2sF4OXf80mDb/dhFxFFuwp5TX4JW8Cg5C3WOK2WjLtqW4ZQjkrQ3fvh+f
|
32
|
+
9rnMcDdbmwI6D/JtrPOa31KlV+7sUF+/0yxZYoJ/yrUjN4JGAhkDhS4uy0SBVf+C
|
33
|
+
26boO9olCrL1Z2Cv6g5b9Kwx4vZgmE6CnOOI3mmgTY74hyWmLndcqZimAyxK8y9r
|
34
|
+
dNJgQLjSfRLjYbrZvgt+hknDO75KO285NBcq62fZUsIpYda9pw32B2uMXmA585jH
|
35
|
+
7fTseCWoJ+htGaGmF2XGa4vzno4Hrx46xtH5bMZXjJrZI5kAQ3q/rrwGTRAlhKXN
|
36
|
+
ohnGnEdpQlxOgeVD510QNHR5
|
33
37
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
38
|
+
date: 2022-01-26 00:00:00.000000000 Z
|
35
39
|
dependencies:
|
36
40
|
- !ruby/object:Gem::Dependency
|
37
41
|
name: kvx
|
@@ -39,22 +43,22 @@ dependencies:
|
|
39
43
|
requirements:
|
40
44
|
- - "~>"
|
41
45
|
- !ruby/object:Gem::Version
|
42
|
-
version: '0
|
46
|
+
version: '1.0'
|
43
47
|
- - ">="
|
44
48
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.
|
49
|
+
version: 1.0.1
|
46
50
|
type: :runtime
|
47
51
|
prerelease: false
|
48
52
|
version_requirements: !ruby/object:Gem::Requirement
|
49
53
|
requirements:
|
50
54
|
- - "~>"
|
51
55
|
- !ruby/object:Gem::Version
|
52
|
-
version: '0
|
56
|
+
version: '1.0'
|
53
57
|
- - ">="
|
54
58
|
- !ruby/object:Gem::Version
|
55
|
-
version: 0.
|
59
|
+
version: 1.0.1
|
56
60
|
description:
|
57
|
-
email:
|
61
|
+
email: digital.robertson@gmail.com
|
58
62
|
executables: []
|
59
63
|
extensions: []
|
60
64
|
extra_rdoc_files: []
|
@@ -80,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
84
|
version: '0'
|
81
85
|
requirements: []
|
82
86
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
87
|
+
rubygems_version: 2.7.10
|
84
88
|
signing_key:
|
85
89
|
specification_version: 4
|
86
90
|
summary: Simple-config makes it convenient to read or write a config file as simple
|
metadata.gz.sig
CHANGED
Binary file
|