downstream 1.3.0 → 1.5.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: 5ceb9c34b8c3146b89ff1a6668ebadc7b4306abdf5b113fca512b1d2fb27cb64
4
- data.tar.gz: 18986657d7665ecd183224025d72ace1013c6ebc3351792863cacca250ff16e7
3
+ metadata.gz: 7596d3ccbd47d258c9b949be9674651c600b75276cd8e38a3bbc021e95ec6214
4
+ data.tar.gz: 8c7c3a0525f38c1a2e155153edca9d5edf39b646495dcc9815dd9181ca502987
5
5
  SHA512:
6
- metadata.gz: 880ea8f11ba29203402f975c523ac695af7befd8c5824a38805d4c48deec84123f0331f354296fe741cfd1341ba29a38c1f6273a4cdb0dccafc312536aa72de1
7
- data.tar.gz: 06faab1f5d2a5d4be4d5a6e82109c197de85e7306f8b6a11d64d304206bf8fe220a3bd1b74dd61a25cb4cf104f1cffae9d5514aea75c60823c6d687e58fe0ac2
6
+ metadata.gz: a02e6ffa1585f399a003750332bc4807bc1d50675f8a8d50968eb8e39de8a7589da82322225a2383d72416d6c2c5fe67aabb376c6df71e6b952579737b587054
7
+ data.tar.gz: 72223db631146986eeb611bd320bae2bf6fc2aa70dc23037a5a8bc820ad84a0015b1b888d51717fb706257ea2a241113552024dde565636adef1951d871286e7
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # Downstream
5
5
 
6
- This gem provides a straightforward way to implement communication between Rails Engines using the Publish-Subscribe pattern. The gem allows decreasing decoupling engines with events. An event is a recorded object in the system that reflects an action that the engine performs, and the params that lead to its creation.
6
+ This gem provides a straightforward way to implement communication between Rails Engines using the Publish-Subscribe pattern. The gem allows decreasing the coupling of engines with events. An event is a recorded object in the system that reflects an action that the engine performs, and the params that lead to its creation.
7
7
 
8
8
  The gem inspired by [`active_event_store`](https://github.com/palkan/active_event_store), and initially based on its codebase. Having said that, it does not store in a database all happened events which ensures simplicity and performance.
9
9
 
@@ -17,10 +17,10 @@ module Downstream
17
17
 
18
18
  def pubsub=(value)
19
19
  @pubsub = case value
20
- when String, Symbol
21
- lookup_pubsub(value)
22
- else
23
- value
20
+ when String, Symbol
21
+ lookup_pubsub(value)
22
+ else
23
+ value
24
24
  end
25
25
  end
26
26
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- GlobalID::Locator.use :downstream do |gid|
3
+ GlobalID::Locator.use "downstream" do |gid|
4
4
  params = gid.params.each_with_object({}) do |(key, value), memo|
5
5
  memo[key.to_sym] = if value.is_a?(String) && value.start_with?("gid://")
6
6
  GlobalID::Locator.locate(value)
@@ -102,7 +102,7 @@ module Downstream
102
102
  end
103
103
  end
104
104
 
105
- super(new_data.merge!(app: :downstream))
105
+ super(new_data.merge!(app: "downstream"))
106
106
  end
107
107
 
108
108
  alias_method :to_gid, :to_global_id
@@ -19,7 +19,7 @@ module Downstream
19
19
  end
20
20
 
21
21
  def publish(identifier, event)
22
- ActiveSupport::Notifications.publish(identifier, event)
22
+ ActiveSupport::Notifications.instrument(identifier, event)
23
23
  end
24
24
  end
25
25
  end
@@ -16,7 +16,7 @@ module Downstream
16
16
  !!async
17
17
  end
18
18
 
19
- def call(_name, event)
19
+ def call(_name, _start, _finish, _id, event)
20
20
  if async?
21
21
  if callable.is_a?(Proc) || callable.name.nil?
22
22
  raise ArgumentError, "Anonymous subscribers (blocks/procs/lambdas or anonymous modules) cannot be asynchronous"
@@ -101,7 +101,7 @@ module Downstream
101
101
  end
102
102
 
103
103
  def message_expectation_modifier
104
- number_modifier = @expected_number == 1 ? "once" : "#{@expected_number} times"
104
+ number_modifier = (@expected_number == 1) ? "once" : "#{@expected_number} times"
105
105
  case @expectation_type
106
106
  when :exactly then "exactly #{number_modifier}"
107
107
  when :at_most then "at most #{number_modifier}"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Downstream
4
- VERSION = "1.3.0"
4
+ VERSION = "1.5.0"
5
5
  end
data/lib/downstream.rb CHANGED
@@ -55,7 +55,7 @@ module Downstream
55
55
  "Please, specify event using `to:` option"
56
56
  end
57
57
 
58
- identifier = if to.is_a?(Class) && Event >= to
58
+ identifier = if to.is_a?(Class) && Event >= to # rubocop:disable Style/YodaCondition
59
59
  to.identifier
60
60
  else
61
61
  to
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: downstream
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - merkushin.m.s@gmail.com
8
8
  - dementiev.vm@gmail.com
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-11-02 00:00:00.000000000 Z
12
+ date: 2024-04-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: after_commit_everywhere
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '0.5'
34
+ version: '1.0'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '0.5'
41
+ version: '1.0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rails
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -143,28 +143,28 @@ dependencies:
143
143
  requirements:
144
144
  - - "~>"
145
145
  - !ruby/object:Gem::Version
146
- version: '5.0'
146
+ version: '6.0'
147
147
  type: :development
148
148
  prerelease: false
149
149
  version_requirements: !ruby/object:Gem::Requirement
150
150
  requirements:
151
151
  - - "~>"
152
152
  - !ruby/object:Gem::Version
153
- version: '5.0'
153
+ version: '6.0'
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: sqlite3
156
156
  requirement: !ruby/object:Gem::Requirement
157
157
  requirements:
158
158
  - - "~>"
159
159
  - !ruby/object:Gem::Version
160
- version: '1.4'
160
+ version: 1.4.0
161
161
  type: :development
162
162
  prerelease: false
163
163
  version_requirements: !ruby/object:Gem::Requirement
164
164
  requirements:
165
165
  - - "~>"
166
166
  - !ruby/object:Gem::Version
167
- version: '1.4'
167
+ version: 1.4.0
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: standard
170
170
  requirement: !ruby/object:Gem::Requirement
@@ -179,8 +179,8 @@ dependencies:
179
179
  - - "~>"
180
180
  - !ruby/object:Gem::Version
181
181
  version: '1.3'
182
- description:
183
- email:
182
+ description:
183
+ email:
184
184
  executables: []
185
185
  extensions: []
186
186
  extra_rdoc_files: []
@@ -199,12 +199,12 @@ files:
199
199
  - lib/downstream/rspec/have_published_event.rb
200
200
  - lib/downstream/subscriber_job.rb
201
201
  - lib/downstream/version.rb
202
- homepage: https://github.com/bibendi/downstream
202
+ homepage: https://github.com/palkan/downstream
203
203
  licenses:
204
204
  - MIT
205
205
  metadata:
206
206
  allowed_push_host: https://rubygems.org
207
- post_install_message:
207
+ post_install_message:
208
208
  rdoc_options: []
209
209
  require_paths:
210
210
  - lib
@@ -212,15 +212,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - ">="
214
214
  - !ruby/object:Gem::Version
215
- version: '2.5'
215
+ version: '2.7'
216
216
  required_rubygems_version: !ruby/object:Gem::Requirement
217
217
  requirements:
218
218
  - - ">="
219
219
  - !ruby/object:Gem::Version
220
220
  version: '0'
221
221
  requirements: []
222
- rubygems_version: 3.1.2
223
- signing_key:
222
+ rubygems_version: 3.4.19
223
+ signing_key:
224
224
  specification_version: 4
225
225
  summary: Straightforward way to implement communication between Rails Engines using
226
226
  the Publish-Subscribe pattern