complex_config 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/VERSION +1 -1
- data/complex_config.gemspec +3 -3
- data/lib/complex_config/settings.rb +8 -1
- data/lib/complex_config/version.rb +1 -1
- data/spec/complex_config/settings_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf10d84d59d6c5fba770ffb599b24b2351d8cdc4
|
4
|
+
data.tar.gz: 4e02c4fe70c59842bc0f1da2062c804568887b95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98ec0b6c60695e4e95e65d3554c46676c787c9f64f73c853a97f20a13d6882cc5f025ed4f3c67464dc23acee82c94067b4d15d381ba5d227b72a9f012365ed81
|
7
|
+
data.tar.gz: b9e7d00e093ee401241d8689d295c0422677833d286fc88a60e4f3b0d4ac326e6e8085ef0fd5d101bb5f92a3e10f15e27cd623ae1fe422743a87da718432f5a5
|
data/README.md
CHANGED
@@ -144,6 +144,10 @@ Here is the `ComplexConfig::Plugins::MONEY` plugin for example:
|
|
144
144
|
|
145
145
|
## Changes
|
146
146
|
|
147
|
+
* 2016-07-21 Release 0.8.0
|
148
|
+
* `ComplexConfig::Settings` can be replaced with `replace_attributes` which
|
149
|
+
allows for easier testing by calling:
|
150
|
+
`cc.foo.replace_attributes(new: 'settings')`.
|
147
151
|
* 2016-07-15 Release 0.7.0
|
148
152
|
* Slim down `ComplexConfig::Settings` interface to avoid clashes with methods
|
149
153
|
mixed into `Object` class or `Enumerable#instance_methods`
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.8.0
|
data/complex_config.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: complex_config 0.
|
2
|
+
# stub: complex_config 0.8.0 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "complex_config"
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.8.0"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
10
10
|
s.authors = ["Florian Frank"]
|
11
|
-
s.date = "2016-07-
|
11
|
+
s.date = "2016-07-27"
|
12
12
|
s.description = "This library allows you to access configuration files via a simple interface"
|
13
13
|
s.email = "flori@ping.de"
|
14
14
|
s.extra_rdoc_files = ["README.md", "lib/complex_config.rb", "lib/complex_config/config.rb", "lib/complex_config/errors.rb", "lib/complex_config/plugins.rb", "lib/complex_config/plugins/enable.rb", "lib/complex_config/plugins/money.rb", "lib/complex_config/plugins/uri.rb", "lib/complex_config/provider.rb", "lib/complex_config/proxy.rb", "lib/complex_config/railtie.rb", "lib/complex_config/rude.rb", "lib/complex_config/settings.rb", "lib/complex_config/shortcuts.rb", "lib/complex_config/version.rb"]
|
@@ -69,6 +69,11 @@ class ComplexConfig::Settings < BasicObject
|
|
69
69
|
@table.values
|
70
70
|
end
|
71
71
|
|
72
|
+
def replace_attributes(hash)
|
73
|
+
@table = self.class.from_hash(hash).table
|
74
|
+
self
|
75
|
+
end
|
76
|
+
|
72
77
|
def to_h
|
73
78
|
table_enumerator.each_with_object({}) do |(k, v), h|
|
74
79
|
h[k] =
|
@@ -160,10 +165,12 @@ class ComplexConfig::Settings < BasicObject
|
|
160
165
|
table_enumerator.each(&block)
|
161
166
|
end
|
162
167
|
|
163
|
-
|
168
|
+
protected
|
164
169
|
|
165
170
|
attr_reader :table
|
166
171
|
|
172
|
+
private
|
173
|
+
|
167
174
|
def table_enumerator
|
168
175
|
@table.enum_for(:each)
|
169
176
|
end
|
@@ -124,4 +124,10 @@ EOT
|
|
124
124
|
settings = ComplexConfig::Settings[zip: 'a string']
|
125
125
|
expect(settings.zip).to eq 'a string'
|
126
126
|
end
|
127
|
+
|
128
|
+
it 'can be replaced for testing' do
|
129
|
+
result = settings.foo.replace_attributes(replaced: true)
|
130
|
+
expect(settings.foo.replaced).to eq true
|
131
|
+
expect(settings.foo).to eq result
|
132
|
+
end
|
127
133
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: complex_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|