confi 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.bundle/config +2 -0
- data/.github/workflows/rake.yml +1 -1
- data/.ruby-gemset +1 -1
- data/.ruby-version +1 -1
- data/Gemfile.lock +67 -25
- data/MIT-LICENSE +1 -1
- data/README.md +1 -1
- data/confi.gemspec +6 -4
- data/lib/confi.rb +8 -3
- data/test/include_test.rb +18 -15
- data/test/instance_test.rb +24 -0
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a193b173edc2a6e936656807497aaab41963d51b7c2f754e7edd4e56a5606d5b
|
|
4
|
+
data.tar.gz: ccc2324b751a7dd5d670ed2068350c4e7e9e77b0b63f12eb1ed13db02aab3275
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3c04b269cca2406bec9a1aaafbc885123cd2ff572a05c6e38bc417e7e3077a39987fe33916fcdc90f67bf49e2eda22ba85b2b5bcae22734fd20a145816355ba3
|
|
7
|
+
data.tar.gz: 857da2ea6ac0cc9c1b720f4124b1f0d2c09fa2e3de39e8605203e1ad532467f1e4bcd53f168726c3dbb7ecf9c83efcc5657cf81b5aed8c2fcbd74eebf02f5371
|
data/.bundle/config
ADDED
data/.github/workflows/rake.yml
CHANGED
data/.ruby-gemset
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
rails-8.
|
|
1
|
+
rails-8.1
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ruby-
|
|
1
|
+
ruby-4.0.2
|
data/Gemfile.lock
CHANGED
|
@@ -1,31 +1,38 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
confi (0.1.
|
|
4
|
+
confi (0.1.4)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
9
|
ast (2.4.3)
|
|
10
|
-
benchmark (0.
|
|
10
|
+
benchmark (0.5.0)
|
|
11
11
|
benchmark-ips (2.14.0)
|
|
12
|
-
byebug (
|
|
12
|
+
byebug (13.0.0)
|
|
13
|
+
reline (>= 0.6.0)
|
|
13
14
|
docile (1.4.1)
|
|
14
|
-
|
|
15
|
+
drb (2.2.3)
|
|
16
|
+
io-console (0.8.2)
|
|
17
|
+
json (2.19.3)
|
|
15
18
|
language_server-protocol (3.17.0.5)
|
|
16
19
|
lint_roller (1.1.0)
|
|
17
|
-
minitest (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
minitest (6.0.3)
|
|
21
|
+
drb (~> 2.0)
|
|
22
|
+
prism (~> 1.5)
|
|
23
|
+
parallel (1.28.0)
|
|
24
|
+
parser (3.3.11.1)
|
|
20
25
|
ast (~> 2.4.1)
|
|
21
26
|
racc
|
|
22
|
-
prism (1.
|
|
27
|
+
prism (1.9.0)
|
|
23
28
|
racc (1.8.1)
|
|
24
29
|
rainbow (3.1.1)
|
|
25
|
-
rake (13.3.
|
|
26
|
-
regexp_parser (2.
|
|
30
|
+
rake (13.3.1)
|
|
31
|
+
regexp_parser (2.11.3)
|
|
32
|
+
reline (0.6.3)
|
|
33
|
+
io-console (~> 0.5)
|
|
27
34
|
ricecream (0.2.1)
|
|
28
|
-
rubocop (1.
|
|
35
|
+
rubocop (1.84.2)
|
|
29
36
|
json (~> 2.3)
|
|
30
37
|
language_server-protocol (~> 3.17.0.2)
|
|
31
38
|
lint_roller (~> 1.1.0)
|
|
@@ -33,38 +40,38 @@ GEM
|
|
|
33
40
|
parser (>= 3.3.0.2)
|
|
34
41
|
rainbow (>= 2.2.2, < 4.0)
|
|
35
42
|
regexp_parser (>= 2.9.3, < 3.0)
|
|
36
|
-
rubocop-ast (>= 1.
|
|
43
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
37
44
|
ruby-progressbar (~> 1.7)
|
|
38
45
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
39
|
-
rubocop-ast (1.
|
|
46
|
+
rubocop-ast (1.49.1)
|
|
40
47
|
parser (>= 3.3.7.2)
|
|
41
|
-
prism (~> 1.
|
|
42
|
-
rubocop-performance (1.
|
|
48
|
+
prism (~> 1.7)
|
|
49
|
+
rubocop-performance (1.26.1)
|
|
43
50
|
lint_roller (~> 1.1)
|
|
44
51
|
rubocop (>= 1.75.0, < 2.0)
|
|
45
|
-
rubocop-ast (>= 1.
|
|
52
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
46
53
|
ruby-progressbar (1.13.0)
|
|
47
54
|
simplecov (0.22.0)
|
|
48
55
|
docile (~> 1.1)
|
|
49
56
|
simplecov-html (~> 0.11)
|
|
50
57
|
simplecov_json_formatter (~> 0.1)
|
|
51
|
-
simplecov-html (0.13.
|
|
58
|
+
simplecov-html (0.13.2)
|
|
52
59
|
simplecov_json_formatter (0.1.4)
|
|
53
|
-
standard (1.
|
|
60
|
+
standard (1.54.0)
|
|
54
61
|
language_server-protocol (~> 3.17.0.2)
|
|
55
62
|
lint_roller (~> 1.0)
|
|
56
|
-
rubocop (~> 1.
|
|
63
|
+
rubocop (~> 1.84.0)
|
|
57
64
|
standard-custom (~> 1.0.0)
|
|
58
65
|
standard-performance (~> 1.8)
|
|
59
66
|
standard-custom (1.0.2)
|
|
60
67
|
lint_roller (~> 1.0)
|
|
61
68
|
rubocop (~> 1.50)
|
|
62
|
-
standard-performance (1.
|
|
69
|
+
standard-performance (1.9.0)
|
|
63
70
|
lint_roller (~> 1.1)
|
|
64
|
-
rubocop-performance (~> 1.
|
|
65
|
-
unicode-display_width (3.
|
|
66
|
-
unicode-emoji (~> 4.
|
|
67
|
-
unicode-emoji (4.0
|
|
71
|
+
rubocop-performance (~> 1.26.0)
|
|
72
|
+
unicode-display_width (3.2.0)
|
|
73
|
+
unicode-emoji (~> 4.1)
|
|
74
|
+
unicode-emoji (4.2.0)
|
|
68
75
|
|
|
69
76
|
PLATFORMS
|
|
70
77
|
ruby
|
|
@@ -81,5 +88,40 @@ DEPENDENCIES
|
|
|
81
88
|
simplecov
|
|
82
89
|
standard
|
|
83
90
|
|
|
91
|
+
CHECKSUMS
|
|
92
|
+
ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
|
|
93
|
+
benchmark (0.5.0) sha256=465df122341aedcb81a2a24b4d3bd19b6c67c1530713fd533f3ff034e419236c
|
|
94
|
+
benchmark-ips (2.14.0) sha256=b72bc8a65d525d5906f8cd94270dccf73452ee3257a32b89fbd6684d3e8a9b1d
|
|
95
|
+
byebug (13.0.0) sha256=d2263efe751941ca520fa29744b71972d39cbc41839496706f5d9b22e92ae05d
|
|
96
|
+
confi (0.1.4)
|
|
97
|
+
docile (1.4.1) sha256=96159be799bfa73cdb721b840e9802126e4e03dfc26863db73647204c727f21e
|
|
98
|
+
drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
|
|
99
|
+
io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc
|
|
100
|
+
json (2.19.3) sha256=289b0bb53052a1fa8c34ab33cc750b659ba14a5c45f3fcf4b18762dc67c78646
|
|
101
|
+
language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
|
|
102
|
+
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
|
|
103
|
+
minitest (6.0.3) sha256=88ac8a1de36c00692420e7cb3cc11a0773bbcb126aee1c249f320160a7d11411
|
|
104
|
+
parallel (1.28.0) sha256=33e6de1484baf2524792d178b0913fc8eb94c628d6cfe45599ad4458c638c970
|
|
105
|
+
parser (3.3.11.1) sha256=d17ace7aabe3e72c3cc94043714be27cc6f852f104d81aa284c2281aecc65d54
|
|
106
|
+
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
|
|
107
|
+
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
|
|
108
|
+
rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
|
|
109
|
+
rake (13.3.1) sha256=8c9e89d09f66a26a01264e7e3480ec0607f0c497a861ef16063604b1b08eb19c
|
|
110
|
+
regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4
|
|
111
|
+
reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
|
|
112
|
+
ricecream (0.2.1) sha256=d32d7781d554d1e1ec44325cabeb22f604a74c563c08d2cfe82f4e2e2bb3ac93
|
|
113
|
+
rubocop (1.84.2) sha256=5692cea54168f3dc8cb79a6fe95c5424b7ea893c707ad7a4307b0585e88dbf5f
|
|
114
|
+
rubocop-ast (1.49.1) sha256=4412f3ee70f6fe4546cc489548e0f6fcf76cafcfa80fa03af67098ffed755035
|
|
115
|
+
rubocop-performance (1.26.1) sha256=cd19b936ff196df85829d264b522fd4f98b6c89ad271fa52744a8c11b8f71834
|
|
116
|
+
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
|
|
117
|
+
simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
|
|
118
|
+
simplecov-html (0.13.2) sha256=bd0b8e54e7c2d7685927e8d6286466359b6f16b18cb0df47b508e8d73c777246
|
|
119
|
+
simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428
|
|
120
|
+
standard (1.54.0) sha256=7a4b08f83d9893083c8f03bc486f0feeb6a84d48233b40829c03ef4767ea0100
|
|
121
|
+
standard-custom (1.0.2) sha256=424adc84179a074f1a2a309bb9cf7cd6bfdb2b6541f20c6bf9436c0ba22a652b
|
|
122
|
+
standard-performance (1.9.0) sha256=49483d31be448292951d80e5e67cdcb576c2502103c7b40aec6f1b6e9c88e3f2
|
|
123
|
+
unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
|
|
124
|
+
unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
|
|
125
|
+
|
|
84
126
|
BUNDLED WITH
|
|
85
|
-
|
|
127
|
+
4.0.6
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
data/confi.gemspec
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# $LOAD_PATH.push File.expand_path("lib", __dir__)
|
|
2
2
|
|
|
3
|
-
VERSION = "0.1.
|
|
3
|
+
VERSION = "0.1.5" # 2016-04-03
|
|
4
|
+
# VERSION = "0.1.4" # 2015-12-27
|
|
5
|
+
# VERSION = "0.1.3" # 2015-06-22
|
|
4
6
|
# VERSION = "0.1.2"
|
|
5
7
|
|
|
6
8
|
Gem::Specification.new do |s|
|
|
@@ -17,8 +19,8 @@ Gem::Specification.new do |s|
|
|
|
17
19
|
|
|
18
20
|
s.files = `git ls-files`.split("\n")
|
|
19
21
|
s.require_paths = ["lib"]
|
|
20
|
-
s.required_ruby_version = "
|
|
22
|
+
s.required_ruby_version = ">= 3"
|
|
21
23
|
|
|
22
|
-
s.add_development_dependency "simplecov"
|
|
23
|
-
s.add_development_dependency "standard"
|
|
24
|
+
s.add_development_dependency "simplecov"
|
|
25
|
+
s.add_development_dependency "standard"
|
|
24
26
|
end
|
data/lib/confi.rb
CHANGED
|
@@ -20,14 +20,19 @@ module Confi
|
|
|
20
20
|
@co_keys ||= []
|
|
21
21
|
@co_keys << key.to_sym
|
|
22
22
|
name = key.to_s
|
|
23
|
-
writer = "#{name}="
|
|
24
|
-
var_name = "@CO_#{name}"
|
|
25
23
|
|
|
24
|
+
define_accessors(name)
|
|
25
|
+
send("#{name}=", value)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def define_accessors(name)
|
|
29
|
+
return if respond_to?(name)
|
|
30
|
+
|
|
31
|
+
var_name = "@CO_#{name}"
|
|
26
32
|
self.class.class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
|
27
33
|
def #{name}; #{var_name}; end
|
|
28
34
|
def #{name}=(x); #{var_name} = x; end
|
|
29
35
|
RUBY
|
|
30
|
-
send(writer, value)
|
|
31
36
|
end
|
|
32
37
|
|
|
33
38
|
def method_missing(method_name, *args)
|
data/test/include_test.rb
CHANGED
|
@@ -10,50 +10,53 @@ describe User do
|
|
|
10
10
|
let(:int) { rand 1..10 }
|
|
11
11
|
let(:symb) { :symbol }
|
|
12
12
|
let(:hsh) { {"a" => 1, "b" => 2} }
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
def setup
|
|
15
|
+
@user = User.new
|
|
16
|
+
end
|
|
14
17
|
|
|
15
18
|
it "rejects uninitialized attribute" do
|
|
16
19
|
assert_raises {
|
|
17
|
-
user.unknown
|
|
20
|
+
@user.unknown
|
|
18
21
|
}
|
|
19
22
|
end
|
|
20
23
|
|
|
21
24
|
it "putter & getter" do
|
|
22
|
-
user.a = symb
|
|
23
|
-
assert_equal symb, user.a
|
|
25
|
+
@user.a = symb
|
|
26
|
+
assert_equal symb, @user.a
|
|
24
27
|
end
|
|
25
28
|
|
|
26
29
|
it "configures with hash" do
|
|
27
|
-
user.configure(hsh)
|
|
30
|
+
@user.configure(hsh)
|
|
28
31
|
|
|
29
|
-
assert_equal 1, user.a
|
|
30
|
-
assert_equal 2, user.b
|
|
32
|
+
assert_equal 1, @user.a
|
|
33
|
+
assert_equal 2, @user.b
|
|
31
34
|
end
|
|
32
35
|
|
|
33
36
|
it "configures with block" do
|
|
34
|
-
user.configure do |spec|
|
|
37
|
+
@user.configure do |spec|
|
|
35
38
|
spec.c = :c
|
|
36
39
|
end
|
|
37
40
|
|
|
38
|
-
assert_equal :c, user.c
|
|
41
|
+
assert_equal :c, @user.c
|
|
39
42
|
end
|
|
40
43
|
|
|
41
44
|
it "configures with hash & block" do
|
|
42
|
-
user.configure(hsh) do |spec|
|
|
45
|
+
@user.configure(hsh) do |spec|
|
|
43
46
|
spec.c = :c
|
|
44
47
|
end
|
|
45
48
|
|
|
46
|
-
assert_equal 1, user.a
|
|
47
|
-
assert_equal :c, user.c
|
|
49
|
+
assert_equal 1, @user.a
|
|
50
|
+
assert_equal :c, @user.c
|
|
48
51
|
end
|
|
49
52
|
|
|
50
53
|
it "configure independent instances" do
|
|
51
54
|
user2 = User.new
|
|
52
|
-
user.a = symb
|
|
55
|
+
@user.a = symb
|
|
53
56
|
user2.a = int
|
|
54
57
|
|
|
55
|
-
assert_equal symb, user.a
|
|
58
|
+
assert_equal symb, @user.a
|
|
56
59
|
assert_equal int, user2.a
|
|
57
|
-
refute_equal user.a, user2.a
|
|
60
|
+
refute_equal @user.a, user2.a
|
|
58
61
|
end
|
|
59
62
|
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
require_relative "../lib/confi"
|
|
3
|
+
|
|
4
|
+
class User
|
|
5
|
+
include Confi
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
describe User do
|
|
9
|
+
let(:symb) { :symbol }
|
|
10
|
+
let(:hsh) { {"a" => 1, "b" => 2} }
|
|
11
|
+
|
|
12
|
+
def setup
|
|
13
|
+
@user = User.new
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "rake warning" do
|
|
17
|
+
@user.a = symb
|
|
18
|
+
assert_equal symb, @user.a
|
|
19
|
+
|
|
20
|
+
@user.configure(hsh)
|
|
21
|
+
assert_equal 1, @user.a
|
|
22
|
+
assert_equal 2, @user.b
|
|
23
|
+
end
|
|
24
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: confi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dittmar Krall
|
|
@@ -45,6 +45,7 @@ executables: []
|
|
|
45
45
|
extensions: []
|
|
46
46
|
extra_rdoc_files: []
|
|
47
47
|
files:
|
|
48
|
+
- ".bundle/config"
|
|
48
49
|
- ".github/workflows/rake.yml"
|
|
49
50
|
- ".gitignore"
|
|
50
51
|
- ".ruby-gemset"
|
|
@@ -61,6 +62,7 @@ files:
|
|
|
61
62
|
- test/benchmark_test.rb
|
|
62
63
|
- test/confi_test.rb
|
|
63
64
|
- test/include_test.rb
|
|
65
|
+
- test/instance_test.rb
|
|
64
66
|
- test/test_helper.rb
|
|
65
67
|
homepage: https://github.com/matique/confi
|
|
66
68
|
licenses:
|
|
@@ -71,7 +73,7 @@ require_paths:
|
|
|
71
73
|
- lib
|
|
72
74
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
73
75
|
requirements:
|
|
74
|
-
- - "
|
|
76
|
+
- - ">="
|
|
75
77
|
- !ruby/object:Gem::Version
|
|
76
78
|
version: '3'
|
|
77
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
@@ -80,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
80
82
|
- !ruby/object:Gem::Version
|
|
81
83
|
version: '0'
|
|
82
84
|
requirements: []
|
|
83
|
-
rubygems_version:
|
|
85
|
+
rubygems_version: 4.0.6
|
|
84
86
|
specification_version: 4
|
|
85
87
|
summary: Auto attr_accessor for a kind of configuration
|
|
86
88
|
test_files: []
|