configatron 3.1.1 → 3.1.2
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/Gemfile.lock +1 -1
- data/lib/configatron/store.rb +22 -1
- data/lib/configatron/version.rb +1 -1
- data/test/configatron/store_test.rb +9 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3432704ea62d8d99a40637794f132e40a6fff33c
|
4
|
+
data.tar.gz: a8c023590a88bd3c44f568cc6f2d4125027f83cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5178a5dd5245ca93e3e9f346f8907f674685b37697b11b25ad5c0ae5f1be27c3a7a73d2e0f0099631eb416c91502988c91c872bcd73e68fb252d1f19e287a70
|
7
|
+
data.tar.gz: 3c06b71333cf213c692fd0aa8ae8d2004bd49fe1c85f8a39a26d37b62c0112b5aa965081e3be331f12a40033b61fb44e59cf5e56046a6bdbdfaf5dec246a8b42
|
data/Gemfile.lock
CHANGED
data/lib/configatron/store.rb
CHANGED
@@ -100,6 +100,28 @@ class Configatron
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
+
def inspect(name = 'configatron')
|
104
|
+
f_out = []
|
105
|
+
@attributes.each do |k, v|
|
106
|
+
if v.is_a?(Configatron::Store)
|
107
|
+
v.inspect("#{name}.#{k}").each_line do |line|
|
108
|
+
if line.match(/\n/)
|
109
|
+
line.each_line do |l|
|
110
|
+
l.strip!
|
111
|
+
f_out << l
|
112
|
+
end
|
113
|
+
else
|
114
|
+
line.strip!
|
115
|
+
f_out << line
|
116
|
+
end
|
117
|
+
end
|
118
|
+
else
|
119
|
+
f_out << "#{name}.#{k} = #{v.inspect}"
|
120
|
+
end
|
121
|
+
end
|
122
|
+
f_out.compact.sort.join("\n")
|
123
|
+
end
|
124
|
+
|
103
125
|
alias :[]= :store
|
104
126
|
alias :blank? :nil?
|
105
127
|
alias :has_key? :key?
|
@@ -108,7 +130,6 @@ class Configatron
|
|
108
130
|
def_delegator :@attributes, :keys
|
109
131
|
def_delegator :@attributes, :each
|
110
132
|
def_delegator :@attributes, :empty?
|
111
|
-
def_delegator :@attributes, :inspect
|
112
133
|
def_delegator :@attributes, :to_h
|
113
134
|
def_delegator :@attributes, :to_hash
|
114
135
|
def_delegator :@attributes, :delete
|
data/lib/configatron/version.rb
CHANGED
@@ -27,7 +27,6 @@ describe Configatron::Store do
|
|
27
27
|
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
30
|
end
|
32
31
|
|
33
32
|
context "[]=" do
|
@@ -245,4 +244,13 @@ describe Configatron::Store do
|
|
245
244
|
|
246
245
|
end
|
247
246
|
|
247
|
+
context '#inspect' do
|
248
|
+
|
249
|
+
it 'returns a printable inspect' do
|
250
|
+
store.a.b = 'B'
|
251
|
+
store.c.d = 'C'
|
252
|
+
store.inspect.must_equal %{configatron.a.b = "B"\nconfigatron.c.d = "C"}
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
248
256
|
end
|