complex_config 0.18.2 → 0.19.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a0d455caf5fdc57de73eafd6308920b5f0b1e5b0bf99b67e289fa4df83b54d6
4
- data.tar.gz: 41948d2b4b6dfcddbcec801639b19a2c855b9c81d573281f098ccb954b9e5606
3
+ metadata.gz: 4ff2b361ee9d3b06983e6ccdcc847a1ca17dd7b41cdf7bc45fc83bc0261b318c
4
+ data.tar.gz: a658135bbc6e28aaef43ec7ba14ec70e8cde6bcdf1a897ddae0c26abd1a5f0fb
5
5
  SHA512:
6
- metadata.gz: 9ec0abc072a32b190f3982254f45a1475a28442d78ac03e80c111a589027bc34b3095f51187b264e17cc74147e1137680494d9c51e7b02b71b9c0ce86e41e6b6
7
- data.tar.gz: be4f16643cb26822aa77d6e68fb82a125fa3b559d0eff6abdb0f0d34fdbe3b48778939392c68cc3747de7e4bf8b0f5b96888d1519414bcb4a64b80ef4f1db516
6
+ metadata.gz: 750968741f4e6744525b091cd101d8e3344ded32f538e98a99f450c553de9b36e7f18d7275c1efacc4319634b85f78549107c1daa05eb24b560464043b0b02e0
7
+ data.tar.gz: 2f6a955ac2ee470429390784b2e886655556ac0c06a3a6d440357a295b62d155c4f8ce6622834a2724671cab5e9a4c28c74f46e05631523bb12fa84c0c96d1d0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.18.2
1
+ 0.19.0
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: complex_config 0.18.2 ruby lib
2
+ # stub: complex_config 0.19.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "complex_config".freeze
6
- s.version = "0.18.2"
6
+ s.version = "0.19.0"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
10
10
  s.authors = ["Florian Frank".freeze]
11
- s.date = "2020-08-26"
11
+ s.date = "2021-01-05"
12
12
  s.description = "This library allows you to access configuration files via a simple interface".freeze
13
13
  s.email = "flori@ping.de".freeze
14
14
  s.executables = ["complex_config".freeze]
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.homepage = "https://github.com/flori/complex_config".freeze
18
18
  s.licenses = ["Apache-2.0".freeze]
19
19
  s.rdoc_options = ["--title".freeze, "ComplexConfig -- configuration library".freeze, "--main".freeze, "README.md".freeze]
20
- s.rubygems_version = "3.1.2".freeze
20
+ s.rubygems_version = "3.2.3".freeze
21
21
  s.summary = "configuration library".freeze
22
22
  s.test_files = ["spec/complex_config/config_spec.rb".freeze, "spec/complex_config/encryption_spec.rb".freeze, "spec/complex_config/key_source_spec.rb".freeze, "spec/complex_config/plugins_spec.rb".freeze, "spec/complex_config/provider_spec.rb".freeze, "spec/complex_config/settings_spec.rb".freeze, "spec/complex_config/shortcuts_spec.rb".freeze, "spec/spec_helper.rb".freeze]
23
23
 
@@ -111,7 +111,7 @@ class ComplexConfig::Settings < BasicObject
111
111
  end
112
112
 
113
113
  def ==(other)
114
- to_h == other.to_h
114
+ other.respond_to?(:to_h) && to_h == other.to_h
115
115
  end
116
116
 
117
117
  def to_yaml
@@ -187,7 +187,7 @@ class ComplexConfig::Settings < BasicObject
187
187
  freeze
188
188
  end
189
189
 
190
- def [](name)
190
+ def attribute_get(name)
191
191
  if !attribute_set?(name) and
192
192
  value = ::ComplexConfig::Provider.apply_plugins(self, name)
193
193
  then
@@ -197,6 +197,16 @@ class ComplexConfig::Settings < BasicObject
197
197
  end
198
198
  end
199
199
 
200
+ alias [] attribute_get
201
+
202
+ def attribute_get!(name)
203
+ if attribute_set?(name)
204
+ attribute_get(name)
205
+ else
206
+ raise ::ComplexConfig::AttributeMissing, "no attribute named #{name.inspect}"
207
+ end
208
+ end
209
+
200
210
  def []=(name, value)
201
211
  @table[name.to_sym] = value
202
212
  end
@@ -1,6 +1,6 @@
1
1
  module ComplexConfig
2
2
  # ComplexConfig version
3
- VERSION = '0.18.2'
3
+ VERSION = '0.19.0'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -133,6 +133,11 @@ EOT
133
133
  expect(settings.foo.baz?).to be_falsy
134
134
  end
135
135
 
136
+ it 'can trigger exception on attribute get' do
137
+ expect(settings.foo.attribute_get!(:bar)).to be_truthy
138
+ expect { settings.foo.attribute_get!(:baz) }.to raise_error ComplexConfig::AttributeMissing
139
+ end
140
+
136
141
  it 'handles arrays correctly' do
137
142
  settings = described_class[ary: [ 1, { hsh: 2 }, 3 ]]
138
143
  expect(settings.to_h).to eq(ary: [ 1, { hsh: 2 }, 3 ])
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.18.2
4
+ version: 0.19.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: 2020-08-26 00:00:00.000000000 Z
11
+ date: 2021-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar
@@ -219,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
219
  - !ruby/object:Gem::Version
220
220
  version: '0'
221
221
  requirements: []
222
- rubygems_version: 3.1.2
222
+ rubygems_version: 3.2.3
223
223
  signing_key:
224
224
  specification_version: 4
225
225
  summary: configuration library