process_settings 0.11.0 → 0.11.1.pre.1

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: 325c0d9bcbdf24e24b98ff61ceb8f66c7a86eedf659703fa1696a9969fc20399
4
- data.tar.gz: fcd0872ad94d1b6946fd577bbe3aaff376febf449f282f149b4cbb40f00cfaaa
3
+ metadata.gz: 074a7a2fc453de9cd6f46546ebe6040c61ebc2532df5bcfa07cb6841b70ef793
4
+ data.tar.gz: 01b1658b4a8d7cef95367cc91685c544417fac81633a736cbab87d791dda17ba
5
5
  SHA512:
6
- metadata.gz: 9b114a06259666f47cb8f052354655ac0ece1f29dafd1ddf4939eb5c197e97aafca65af0c4c3a8ee383d2d739caef0769226d38365f48687410a001f1054bae4
7
- data.tar.gz: f09a461c8826e55797c67c6222084510933ba30d4c2696c82ff4193a0d22bf1c011a1112a703c2bf3582e68af6e258f6ee93adee2d505a71981c7715c0f59970
6
+ metadata.gz: 0025db7a10cc0157579a3bb3890b092626f613e01da5dd132e9017e634393b7fa15eb724070be939fe17e37816df08c43585dbdecf37f0437fd5b25261dc3874
7
+ data.tar.gz: c517c8d7e7d96f17e1fb1de6e0484793cbc9e9ae32add2238b48fae6b4619cb862e03ba7d3786490134acf1226f41db2b4bf204b4862010e51d5a1fc5c16e26f
data/README.md CHANGED
@@ -126,16 +126,20 @@ The simplest approach--as shown above--is to read the latest settings at any tim
126
126
  http_version = ProcessSettings['frontend', 'http_version']
127
127
  ```
128
128
 
129
- #### Register an `on_change` Callback
130
- Alternatively, if you need to execute some code when there is a change, register a callback with `ProcessSettings.instance#on_change`:
129
+ #### Register a `when_updated` Callback
130
+ Alternatively, if you need to execute initially and whenever the value is updated, register a callback with `ProcessSettings.instance#when_updated`:
131
131
  ```
132
- ProcessSettings.instance.on_change do
132
+ ProcessSettings.instance.when_updated do
133
133
  logger.level = ProcessSettings['frontend', 'log_level']
134
134
  end
135
135
  ```
136
- Note that all callbacks run sequentially on the shared change monitoring thread, so please be considerate!
136
+ By default, the `when_updated` block is called initially when registered. We've found this to be convenient in most cases; it can be disabled by passing `initial_update: false`, in which case the block will be called 0 or more times in the future, when any of the process settings for this process change.
137
+
138
+ `when_updated` is idempotent.
137
139
 
138
- There is no provision for unregistering callbacks. Instead, replace the `instance` of the monitor with a new one.
140
+ In case you need to cancel the callback later, `when_updated` returns a handle (the block itself) which can later be passed into `cancel_when_updated`.
141
+
142
+ Note that all callbacks run sequentially on the shared change monitoring thread, so please be considerate!
139
143
 
140
144
  ## Targeting
141
145
  Each settings YAML file has an optional `target` key at the top level, next to `settings`.
@@ -12,10 +12,10 @@ module ProcessSettings
12
12
  class << self
13
13
  def included(including_klass)
14
14
  after_method =
15
- if including_klass.respond_to?(:teardown)
16
- :teardown
17
- else
15
+ if including_klass.respond_to?(:after)
18
16
  :after
17
+ else
18
+ :teardown
19
19
  end
20
20
 
21
21
  including_klass.send(after_method) do
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ProcessSettings
4
- VERSION = '0.11.0'
4
+ VERSION = '0.11.1.pre.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: process_settings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Invoca
@@ -108,9 +108,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
108
  version: '0'
109
109
  required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - ">="
111
+ - - ">"
112
112
  - !ruby/object:Gem::Version
113
- version: '0'
113
+ version: 1.3.1
114
114
  requirements: []
115
115
  rubygems_version: 3.0.3
116
116
  signing_key: