deimos-ruby 1.4.0.pre.beta2 → 1.4.0.pre.beta3

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
  SHA256:
3
- metadata.gz: af6aca3bfdec091463dfbc9774d0c3f41e38020c2f8c634609d2471dc327479e
4
- data.tar.gz: 727a05937a6814e650898fd239aa53075b16d354600909cd76308aa6b697226a
3
+ metadata.gz: 755a361a8e3344715436d6a90e45f4d27ceab2eba219291b59055ca2e7afcc39
4
+ data.tar.gz: 8678c4ebad89bf1f58f82190af970f346360dc0a768b2adc075d80bad92dde0a
5
5
  SHA512:
6
- metadata.gz: 26c751b958de521c87a8824c77f3c47db65806aad257c4948f27b4be4a4b559cf768b3d0291a10060539f9306c748d3028e43c15599f87680be83d8001b751d3
7
- data.tar.gz: 8f97fb5eb5fb8538f2fce6806f9d8a152d6b458f56da30ae0e68fa9892bfe6f86679e55b295e2b342b687a912cb7e6345e9047ec4d7d783f0e4f539f52245405
6
+ metadata.gz: 22b5010a4d5b3f4cb6423237f13eb8081f232520749252ffa8c37df38516f7155e2a7f9b5d4d68ac3c9b948b7aee144201bffcc3488c6341c14fb97f6fee67a5
7
+ data.tar.gz: dad1196a141be2b076f4c0043f5ce9250b89bb115ae07cc07861c5b9085f1f58878e786a9235c107244fad0b933c2899fa93f23568a9d9ada9d95c7bdae12c86
data/CHANGELOG.md CHANGED
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## UNRELEASED
9
9
 
10
+ # [1.4.0-beta3] - 2019-11-26
11
+ - Added `define_settings` to define settings without invoking callbacks.
12
+
10
13
  # [1.4.0-beta2] - 2019-11-22
11
14
  - FIX: settings with default_proc were being called immediately
12
15
  instead of being lazy-evaluated.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- deimos-ruby (1.4.0.pre.beta2)
4
+ deimos-ruby (1.4.0.pre.beta3)
5
5
  avro-patches (~> 0.3)
6
6
  avro_turf (~> 0.8)
7
7
  phobos (~> 1.8.2.pre.beta2)
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'active_support/concern'
4
+ require 'active_support/callbacks'
4
5
 
5
6
  module Deimos
6
7
  # Module to allow configuration. Loosely based off of the dry-configuration
@@ -24,7 +25,7 @@ module Deimos
24
25
  # end
25
26
  # - Allows to call `configure` multiple times without crashing.
26
27
  # - Allows to lazy-set default values by passing a proc as a default:
27
- # Deimos.configure do |config|
28
+ # Deimos.define_settings do |config|
28
29
  # setting :my_val, default_proc: proc { MyDefault.calculated_value }
29
30
  # end
30
31
  # - Support for setting up and automatically calling deprecated configurations.
@@ -237,7 +238,12 @@ module Deimos
237
238
 
238
239
  # :nodoc:
239
240
  module ClassMethods
240
- # Pass the configuration into a block.
241
+ # Define and redefine settings.
242
+ def define_settings(&block)
243
+ config.instance_eval(&block)
244
+ end
245
+
246
+ # Configure the settings with values.
241
247
  def configure(&block)
242
248
  config.run_callbacks(:configure) do
243
249
  config.instance_eval(&block)
@@ -72,7 +72,7 @@ module Deimos
72
72
  end
73
73
  end
74
74
 
75
- configure do
75
+ define_settings do
76
76
 
77
77
  # @return [Logger]
78
78
  setting :logger, Logger.new(STDOUT)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Deimos
4
- VERSION = '1.4.0-beta2'
4
+ VERSION = '1.4.0-beta3'
5
5
  end
@@ -4,7 +4,7 @@
4
4
  class MyConfig
5
5
  include Deimos::Configurable
6
6
 
7
- configure do
7
+ define_settings do
8
8
  setting :set1
9
9
  setting :set2, 'hi mom'
10
10
  setting :group do
@@ -35,7 +35,7 @@ describe Deimos::Configurable do
35
35
  num_calls += 1
36
36
  num_calls
37
37
  end
38
- MyConfig.configure do
38
+ MyConfig.define_settings do
39
39
  setting :set_with_proc, default_proc: value_proc
40
40
  end
41
41
  expect(num_calls).to eq(0)
@@ -95,7 +95,7 @@ describe Deimos::Configurable do
95
95
  end
96
96
 
97
97
  it 'should add or redefine settings' do
98
- MyConfig.configure do
98
+ MyConfig.define_settings do
99
99
  setting :group do
100
100
  setting :set6, 15
101
101
  setting :set5, (proc { 15 })
@@ -124,14 +124,13 @@ describe Deimos::Configurable do
124
124
  expect(MyConfig.config.listy_objects.first.list1).to eq(0)
125
125
 
126
126
  # This should not remove any keys
127
- MyConfig.configure do
127
+ MyConfig.define_settings do
128
128
  setting :group do
129
129
  setting :set6, 20
130
130
  end
131
131
  end
132
132
  expect(MyConfig.config.group.set6).to eq(20)
133
133
  expect(MyConfig.config.group.set5.call).to eq(15)
134
-
135
134
  end
136
135
 
137
136
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deimos-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0.pre.beta2
4
+ version: 1.4.0.pre.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Orner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-22 00:00:00.000000000 Z
11
+ date: 2019-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avro-patches