configatron 3.1.1 → 3.1.2

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
  SHA1:
3
- metadata.gz: 43ae27d34852f0d6b2bc628059ad7189f2695d04
4
- data.tar.gz: 5c8e68f8aafbf7d9f30ddc3a95110cee6405f0fe
3
+ metadata.gz: 3432704ea62d8d99a40637794f132e40a6fff33c
4
+ data.tar.gz: a8c023590a88bd3c44f568cc6f2d4125027f83cb
5
5
  SHA512:
6
- metadata.gz: 7f5ba8a9bcc0785bea2cbd94f8c3983485953456be4e308bdc49bb32c93ba0a31aa6c69afe97ca67a48525262b99294ff7425948b82ad0e01349235614d0ee16
7
- data.tar.gz: cb430f0b8c6fbe6051745b23eb26e06f45ed78814fef5f1f464e1083368fe620c7ebc3ea4c02e8732292735ab8593543fdc8cc12cf7ae6afe1b5353bddbb826e
6
+ metadata.gz: d5178a5dd5245ca93e3e9f346f8907f674685b37697b11b25ad5c0ae5f1be27c3a7a73d2e0f0099631eb416c91502988c91c872bcd73e68fb252d1f19e287a70
7
+ data.tar.gz: 3c06b71333cf213c692fd0aa8ae8d2004bd49fe1c85f8a39a26d37b62c0112b5aa965081e3be331f12a40033b61fb44e59cf5e56046a6bdbdfaf5dec246a8b42
data/Gemfile.lock CHANGED
@@ -9,7 +9,7 @@ GIT
9
9
  PATH
10
10
  remote: .
11
11
  specs:
12
- configatron (3.1.1)
12
+ configatron (3.1.2)
13
13
 
14
14
  GEM
15
15
  remote: https://rubygems.org/
@@ -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
@@ -1,3 +1,3 @@
1
1
  class Configatron
2
- VERSION = "3.1.1"
2
+ VERSION = "3.1.2"
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configatron
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Bates