dry-events 0.1.0 → 0.2.0

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: 8df0a07c20aa79e2b47d1f8eda583936b6109e09e5307826593e1e8f792c7675
4
- data.tar.gz: c99dfee0bf7614b62fc70d8ea809d419fcf8fb01400149f83610fd9a9e586019
3
+ metadata.gz: 1423fe7cb9ad77d3af4fea999666f1ff275204e5dad84e4ba8f83ea230b0e2d0
4
+ data.tar.gz: 30a0f8b923a890af19b9937fbf502b51c8a568b33444bba0f3d09995045a016d
5
5
  SHA512:
6
- metadata.gz: 3060f0fe13e7cb9199e81e82c82be67bca90a547a0750b094f0afcdcb193aba0866c3c3a7af2e81923dec194bc1828d9fc4ae7fa099c0c87952cba68f77afff2
7
- data.tar.gz: 33845156cc553098260f562001b3fa0d2aa711c95ee8d056c0f1362eccda69e8b8954040bf0b542b47826a81b813d1a338ced05712e10e36a8770fad4eef867f
6
+ metadata.gz: d985af03635dea492d89ae37dd5935aa4576d92ca2201bbf4096d12a396df7857fd0007bf7a28275f7d5a985560ef26532ca977bf1ea05e04e815d88db02bd8f
7
+ data.tar.gz: 8de1e80e33a2a5429fddce3a675ed9c72ae5224bc919d6fcab5300f4f8d7b11617d18330b0af5451884e76accbc755b37d4282155c0aa52dbddd380e1cc723af
@@ -2,21 +2,23 @@ language: ruby
2
2
  cache: bundler
3
3
  bundler_args: --without benchmarks console tools
4
4
  script: "bundle exec rake ci"
5
- before_install: gem update --system
6
5
  after_success:
7
6
  - '[ "${TRAVIS_JOB_NUMBER#*.}" = "1" ] && [ "$TRAVIS_BRANCH" = "master" ] && bundle exec codeclimate-test-reporter'
8
7
  rvm:
9
- - 2.5.0
10
- - 2.4.3
11
- - 2.3.6
12
- - jruby-9.1.9.0
8
+ - 2.6.3
9
+ - 2.5.5
10
+ - 2.4.6
11
+ - jruby-9.2.7.0
12
+ - truffleruby
13
+ matrix:
14
+ allow_failures:
15
+ - rvm: truffleruby
16
+ - rvm: jruby-9.2.7.0
13
17
  env:
14
18
  global:
15
19
  - COVERAGE='true'
16
20
  notifications:
17
21
  webhooks:
18
- urls:
19
- - https://webhooks.gitter.im/e/19098b4253a72c9796db
20
22
  on_success: change
21
23
  on_failure: always
22
24
  on_start: false
@@ -1,3 +1,41 @@
1
- # v0.1.0 to-be-released
1
+ # v0.2.0 2019-07-24
2
+
3
+ ## Fixed
4
+
5
+ * Trying to subscribe to a non-existant event raises an exception (issue #3) (@GustavoCaso + @mensfeld)
6
+
7
+ [Compare v0.1.1...v0.2.0](https://github.com/dry-rb/dry-events/compare/v0.1.1...v0.2.0)
8
+
9
+ # v0.1.1 2019-03-22
10
+
11
+ ## Added
12
+
13
+ - Subscription filters can be more complex: nested hash inclusion, array inclusion, and proc checks were added (flash-gordon)
14
+ ```ruby
15
+ # nested hash check
16
+ subscribe(:event, logger: { level: :info })
17
+ # pass
18
+ trigger(:event, logger: { level: :info, output: :stdin })
19
+ # filtered out
20
+ trigger(:event, logger: { level: :debug })
21
+ trigger(:event, something: :else)
22
+
23
+ # array inclusion
24
+ subscribe(:event, logger: { level: %i(info warn error) })
25
+ # pass
26
+ trigger(:event, logger: { level: :info })
27
+ trigger(:event, logger: { level: :error })
28
+ trigger(:event, logger: { level: :info, output: :stdin })
29
+ # filtered out
30
+ trigger(:event, logger: { level: :debug })
31
+
32
+ # proc checks
33
+ # here acts as array inclusion example
34
+ subscribe(:event, logger: { level: -> level { %i(info warn error).include?(level) })
35
+ ```
36
+
37
+ [Compare v0.1.0...v0.1.1](https://github.com/dry-rb/dry-events/compare/v0.1.0...v0.1.1)
38
+
39
+ # v0.1.0 2018-01-02
2
40
 
3
41
  First public release
data/Gemfile CHANGED
@@ -9,5 +9,6 @@ group :test do
9
9
  end
10
10
 
11
11
  group :tools do
12
- gem 'byebug', platform: :mri
12
+ gem 'pry'
13
+ gem 'pry-byebug', platform: :mri
13
14
  end
data/README.md CHANGED
@@ -1,26 +1,24 @@
1
1
  [gem]: https://rubygems.org/gems/dry-events
2
- [travis]: https://travis-ci.org/dry-rb/dry-events
3
- [gemnasium]: https://gemnasium.com/dry-rb/dry-events
2
+ [travis]: https://travis-ci.com/dry-rb/dry-events
4
3
  [codeclimate]: https://codeclimate.com/github/dry-rb/dry-events
5
- [coveralls]: https://coveralls.io/r/dry-rb/dry-events
4
+ [chat]: https://dry-rb.zulipchat.com
6
5
  [inchpages]: http://inch-ci.org/github/dry-rb/dry-events
7
6
 
8
- # dry-events [![Join the chat at https://gitter.im/dry-rb/chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dry-rb/chat)
7
+ # dry-events [![Join the chat at https://dry-rb.zulipchat.com](https://img.shields.io/badge/dry--rb-join%20chat-%23346b7a.svg)][chat]
9
8
 
10
9
  [![Gem Version](https://badge.fury.io/rb/dry-events.svg)][gem]
11
- [![Build Status](https://travis-ci.org/dry-rb/dry-events.svg?branch=master)][travis]
12
- [![Dependency Status](https://gemnasium.com/dry-rb/dry-events.svg)][gemnasium]
10
+ [![Build Status](https://travis-ci.com/dry-rb/dry-events.svg?branch=master)][travis]
13
11
  [![Code Climate](https://codeclimate.com/github/dry-rb/dry-events/badges/gpa.svg)][codeclimate]
14
12
  [![Test Coverage](https://codeclimate.com/github/dry-rb/dry-events/badges/coverage.svg)][codeclimate]
15
13
  [![Inline docs](http://inch-ci.org/github/dry-rb/dry-events.svg?branch=master)][inchpages]
16
14
 
17
15
  Standalone pub/sub system.
18
16
 
19
- ## Synopsis
17
+ ## Links
20
18
 
21
- ``` ruby
22
- ```
19
+ * [User docs](http://dry-rb.org/gems/dry-events)
20
+ * [API docs](http://rubydoc.info/gems/dry-events)
23
21
 
24
- ## License
22
+ ## LICENSE
25
23
 
26
24
  See `LICENSE` file.
@@ -18,7 +18,6 @@ module Dry
18
18
 
19
19
  # Initialize a new event bus
20
20
  #
21
- # @param [Symbol] id The bus identifier
22
21
  # @param [Hash] events A hash with events
23
22
  # @param [Hash] listeners A hash with listeners
24
23
  #
@@ -29,11 +28,11 @@ module Dry
29
28
  end
30
29
 
31
30
  # @api private
32
- def process(event_id, payload, &block)
33
- listeners[event_id].each do |(listener, query)|
31
+ def process(event_id, payload)
32
+ listeners[event_id].each do |listener, filter|
34
33
  event = events[event_id].payload(payload)
35
34
 
36
- if event.trigger?(query)
35
+ if filter.(payload)
37
36
  yield(event, listener)
38
37
  end
39
38
  end
@@ -47,12 +46,12 @@ module Dry
47
46
  end
48
47
 
49
48
  # @api private
50
- def attach(listener, query)
49
+ def attach(listener, filter)
51
50
  events.each do |id, event|
52
51
  meth = event.listener_method
53
52
 
54
53
  if listener.respond_to?(meth)
55
- listeners[id] << [listener.method(meth), query]
54
+ listeners[id] << [listener.method(meth), filter]
56
55
  end
57
56
  end
58
57
  end
@@ -68,14 +67,27 @@ module Dry
68
67
  end
69
68
 
70
69
  # @api private
71
- def subscribe(event_id, query, &block)
72
- listeners[event_id] << [block, query]
70
+ def subscribe(event_id, filter, &block)
71
+ listeners[event_id] << [block, filter]
73
72
  self
74
73
  end
75
74
 
76
75
  # @api private
77
76
  def subscribed?(listener)
78
- listeners.values.any? { |value| value.any? { |(block, _)| block.equal?(listener) } }
77
+ listeners.values.any? { |value| value.any? { |block, _| block.equal?(listener) } }
78
+ end
79
+
80
+ # @api private
81
+ def can_handle?(object_or_event_id)
82
+ case object_or_event_id
83
+ when String, Symbol
84
+ events.key?(object_or_event_id)
85
+ else
86
+ events
87
+ .values
88
+ .map(&:listener_method)
89
+ .any?(&object_or_event_id.method(:respond_to?))
90
+ end
79
91
  end
80
92
  end
81
93
  end
@@ -9,22 +9,36 @@ module Dry
9
9
  class Event
10
10
  include Dry::Equalizer(:id, :payload)
11
11
 
12
+ InvalidEventNameError = Class.new(StandardError) do
13
+ # @api private
14
+ def initialize
15
+ super("please provide a valid event name, it could be either String or Symbol")
16
+ end
17
+ end
18
+
12
19
  DOT = '.'.freeze
13
20
  UNDERSCORE = '_'.freeze
14
21
 
15
22
  # @!attribute [r] id
16
- # @return [Symbol] The event identifier
23
+ # @return [Symbol, String] The event identifier
17
24
  attr_reader :id
18
25
 
26
+ # @api private
27
+ def self.new(id, payload = EMPTY_HASH)
28
+ return super(id, payload) if (id.is_a?(String) || id.is_a?(Symbol)) && !id.empty?
29
+
30
+ raise InvalidEventNameError.new
31
+ end
32
+
19
33
  # Initialize a new event
20
34
  #
21
- # @param [Symbol] id The event identifier
22
- # @param [Hash] payload Optional payload
35
+ # @param [Symbol, String] id The event identifier
36
+ # @param [Hash] payload
23
37
  #
24
38
  # @return [Event]
25
39
  #
26
40
  # @api private
27
- def initialize(id, payload = EMPTY_HASH)
41
+ def initialize(id, payload)
28
42
  @id = id
29
43
  @payload = payload
30
44
  end
@@ -66,11 +80,6 @@ module Dry
66
80
  end
67
81
  end
68
82
 
69
- # @api private
70
- def trigger?(query)
71
- query.empty? || query.all? { |key, value| payload[key] == value }
72
- end
73
-
74
83
  # @api private
75
84
  def listener_method
76
85
  @listener_method ||= :"on_#{id.to_s.gsub(DOT, UNDERSCORE)}"
@@ -0,0 +1,72 @@
1
+ require 'set'
2
+
3
+ module Dry
4
+ module Events
5
+ # Event filter
6
+ #
7
+ # A filter cherry-picks probes payload of events.
8
+ # Events not matching the predicates don't fire callbacks.
9
+ #
10
+ # @api private
11
+ class Filter
12
+ NO_MATCH = Object.new.freeze
13
+
14
+ # @!attribute [r] events
15
+ # @return [Array] A list of lambdas checking payloads
16
+ attr_reader :checks
17
+
18
+ # Create a new filter
19
+ #
20
+ # @param [Hash] filter Source filter
21
+ #
22
+ # @api private
23
+ def initialize(filter)
24
+ @checks = build_checks(filter)
25
+ end
26
+
27
+ # Test event payload against the checks
28
+ #
29
+ # @param [Hash] payload Event payload
30
+ #
31
+ # @api private
32
+ def call(payload = EMPTY_HASH)
33
+ checks.all? { |check| check.(payload) }
34
+ end
35
+
36
+ # Recursively build checks
37
+ #
38
+ # @api private
39
+ def build_checks(filter, checks = EMPTY_ARRAY, keys = EMPTY_ARRAY)
40
+ if filter.is_a?(Hash)
41
+ filter.reduce(checks) do |cs, (key, value)|
42
+ build_checks(value, cs, [*keys, key])
43
+ end
44
+ else
45
+ [*checks, method(:compare).curry.(keys, predicate(filter))]
46
+ end
47
+ end
48
+
49
+ # @api private
50
+ def compare(path, predicate, payload)
51
+ value = path.reduce(payload) do |acc, key|
52
+ if acc.is_a?(Hash) && acc.key?(key)
53
+ acc[key]
54
+ else
55
+ break NO_MATCH
56
+ end
57
+ end
58
+
59
+ predicate.(value)
60
+ end
61
+
62
+ # @api private
63
+ def predicate(value)
64
+ case value
65
+ when Proc then value
66
+ when Array then value.method(:include?)
67
+ else value.method(:==)
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -11,7 +11,7 @@ module Dry
11
11
  #
12
12
  # register_event("users.created")
13
13
  # end
14
-
14
+ #
15
15
  # class MyListener
16
16
  # include Dry::Events::Listener[:app]
17
17
  #
@@ -5,6 +5,7 @@ require 'dry/core/class_attributes'
5
5
  require 'dry/events/constants'
6
6
  require 'dry/events/event'
7
7
  require 'dry/events/bus'
8
+ require 'dry/events/filter'
8
9
 
9
10
  module Dry
10
11
  module Events
@@ -18,6 +19,19 @@ module Dry
18
19
  end
19
20
  end
20
21
 
22
+ # @api public
23
+ InvalidSubscriberError = Class.new(StandardError) do
24
+ # @api private
25
+ def initialize(object_or_event_id)
26
+ case object_or_event_id
27
+ when String, Symbol
28
+ super("you are trying to subscribe to an event: `#{object_or_event_id}` that has not been registered")
29
+ else
30
+ super("you try use subscriber object that will never be executed")
31
+ end
32
+ end
33
+ end
34
+
21
35
  # Extension used for classes that can publish events
22
36
  #
23
37
  # @example
@@ -116,13 +130,13 @@ module Dry
116
130
  # Subscribe to an event
117
131
  #
118
132
  # @param [Symbol,String] event_id The event identifier
119
- # @param [Hash] query An optional query for conditional listeners
133
+ # @param [Hash] filter_hash An optional filter for conditional listeners
120
134
  #
121
135
  # @return [Class] publisher class
122
136
  #
123
137
  # @api public
124
- def subscribe(event_id, query = EMPTY_HASH, &block)
125
- listeners[event_id] << [block, query]
138
+ def subscribe(event_id, filter_hash = EMPTY_HASH, &block)
139
+ listeners[event_id] << [block, Filter.new(filter_hash)]
126
140
  self
127
141
  end
128
142
 
@@ -180,21 +194,28 @@ module Dry
180
194
 
181
195
  # Subscribe to events.
182
196
  #
183
- # If the query parameter is provided, filters events by payload.
197
+ # If the filter parameter is provided, filters events by payload.
184
198
  #
185
199
  # @param [Symbol,String,Object] object_or_event_id The event identifier or a listener object
186
- # @param [Hash] query An optional event filter
200
+ # @param [Hash] filter_hash An optional event filter
187
201
  #
188
202
  # @return [Object] self
189
203
  #
190
204
  # @api public
191
- def subscribe(object_or_event_id, query = EMPTY_HASH, &block)
192
- if block
193
- __bus__.subscribe(object_or_event_id, query, &block)
205
+ def subscribe(object_or_event_id, filter_hash = EMPTY_HASH, &block)
206
+ if __bus__.can_handle?(object_or_event_id)
207
+ filter = Filter.new(filter_hash)
208
+
209
+ if block
210
+ __bus__.subscribe(object_or_event_id, filter, &block)
211
+ else
212
+ __bus__.attach(object_or_event_id, filter)
213
+ end
214
+
215
+ self
194
216
  else
195
- __bus__.attach(object_or_event_id, query)
217
+ raise InvalidSubscriberError, object_or_event_id
196
218
  end
197
- self
198
219
  end
199
220
 
200
221
  # Unsubscribe a listener
@@ -217,7 +238,7 @@ module Dry
217
238
 
218
239
  # Utility method which yields event with each of its listeners
219
240
  #
220
- # Listeners are already filtered out when query was provided during
241
+ # Listeners are already filtered out when filter was provided during
221
242
  # subscription
222
243
  #
223
244
  # @param [Symbol,String] event_id The event identifier
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  module Events
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '0.2.0'.freeze
4
4
  end
5
5
  end
@@ -6,7 +6,8 @@ if RUBY_ENGINE == 'ruby' && ENV['COVERAGE'] == 'true'
6
6
  end
7
7
 
8
8
  begin
9
- require 'byebug'
9
+ require 'pry'
10
+ require 'pry-byebug'
10
11
  rescue LoadError; end
11
12
 
12
13
  require 'dry-events'
@@ -17,7 +18,9 @@ Dir[SPEC_ROOT.join('shared/**/*.rb')].each(&method(:require))
17
18
  Dir[SPEC_ROOT.join('support/**/*.rb')].each(&method(:require))
18
19
 
19
20
  RSpec.configure do |config|
21
+ config.warnings = true
20
22
  config.disable_monkey_patching!
23
+ config.filter_run_when_matching :focus
21
24
 
22
25
  config.after(:example) do
23
26
  Dry::Events::Publisher.instance_variable_set(:@__registry__, Concurrent::Map.new)
@@ -0,0 +1,66 @@
1
+ require 'dry/events/event'
2
+
3
+ RSpec.describe Dry::Events::Event do
4
+ subject(:event) do
5
+ described_class.new(event_id, payload)
6
+ end
7
+
8
+ let(:payload) { {} }
9
+
10
+ describe 'invalid event name' do
11
+ let(:event_id) { nil }
12
+ it 'raises InvalidEventNameError' do
13
+ expect{ event }.to raise_error(Dry::Events::Event::InvalidEventNameError)
14
+ end
15
+ end
16
+
17
+ describe '#[]' do
18
+ let(:event_id) { :test }
19
+ let(:payload) { {test: :foo} }
20
+
21
+ it 'fetches payload key' do
22
+ expect(event[:test]).to eq :foo
23
+ end
24
+
25
+ it 'raises KeyError when no key found' do
26
+ expect { event[:fake] }.to raise_error(KeyError)
27
+ end
28
+ end
29
+
30
+ describe '#payload' do
31
+ let(:event_id) { :test }
32
+ let(:payload) { {test: :foo} }
33
+
34
+ it 'returns payload if no argument' do
35
+ expect(event.payload).to eq payload
36
+ end
37
+
38
+ it 'returns new event with payload payload' do
39
+ new_event = event.payload({ bar: :baz })
40
+ expect(new_event).to_not eq event
41
+ expect(new_event.payload).to eq ({test: :foo, bar: :baz})
42
+ end
43
+ end
44
+
45
+ describe '#to_h' do
46
+ let(:event_id) { :test }
47
+ let(:payload) { {test: :foo} }
48
+
49
+ it 'returns payload' do
50
+ expect(event.to_h).to eq payload
51
+ end
52
+ end
53
+
54
+ describe '#listener_method' do
55
+ let(:event_id) { :test }
56
+
57
+ it 'returns listener method name' do
58
+ expect(event.listener_method).to eq :on_test
59
+ end
60
+
61
+ it 'replaces dots for underscores' do
62
+ ev = Dry::Events::Event.new('hello.world')
63
+ expect(ev.listener_method).to eq :on_hello_world
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,74 @@
1
+ RSpec.describe Dry::Events::Filter do
2
+ subject(:filter) { described_class.new(query) }
3
+
4
+ context 'nested hash' do
5
+ let(:query) do
6
+ { logger: { level: :info } }
7
+ end
8
+
9
+ specify do
10
+ expect(filter.()).to be false
11
+ expect(filter.(logger: { level: :info, output: :stdin })).to be true
12
+ expect(filter.(logger: { level: :debug })).to be false
13
+ expect(filter.(logger: :debug)).to be false
14
+ end
15
+ end
16
+
17
+ context 'multi-value check' do
18
+ let(:query) do
19
+ { logger: { level: :info, output: :stdin } }
20
+ end
21
+
22
+ specify do
23
+ expect(filter.()).to be false
24
+ expect(filter.(logger: { level: :info, output: :stdin })).to be true
25
+ expect(filter.(logger: { level: :info })).to be false
26
+ end
27
+ end
28
+
29
+ context 'top-level array' do
30
+ let(:query) { %i(error fatal) }
31
+
32
+ specify do
33
+ expect(filter.()).to be false
34
+ expect(filter.(random: :hash)).to be false
35
+ expect(filter.(:error)).to be true
36
+ end
37
+ end
38
+
39
+ context 'nested array' do
40
+ let(:query) do
41
+ { logger: { level: %i(info warn error fatal) } }
42
+ end
43
+
44
+ specify do
45
+ expect(filter.()).to be false
46
+ expect(filter.(logger: { level: :info, output: :stdin })).to be true
47
+ expect(filter.(logger: { level: :fatal })).to be true
48
+ expect(filter.(logger: { level: :debug })).to be false
49
+ expect(filter.(level: :debug)).to be false
50
+ end
51
+ end
52
+
53
+ context 'nested proc' do
54
+ let(:query) do
55
+ { logger: { level: -> level { %i(error fatal).include?(level) } } }
56
+ end
57
+
58
+ specify do
59
+ expect(filter.()).to be false
60
+ expect(filter.(logger: { level: :error, output: :stdin })).to be true
61
+ end
62
+ end
63
+
64
+ context 'top-level proc' do
65
+ let(:query) do
66
+ -> level: :debug, ** { %i(error fatal).include?(level) }
67
+ end
68
+
69
+ specify do
70
+ expect(filter.()).to be false
71
+ expect(filter.(level: :error, output: :stdin)).to be true
72
+ end
73
+ end
74
+ end
@@ -16,16 +16,30 @@ RSpec.describe Dry::Events::Listener do
16
16
  end
17
17
 
18
18
  describe '.subscribe' do
19
- it 'subscribes a listener at class level' do
20
- result = []
19
+ let(:captured) { [] }
21
20
 
21
+ it 'subscribes a listener at class level' do
22
22
  listener.subscribe(:test_event) do |event|
23
- result << event.id
23
+ captured << event.id
24
24
  end
25
25
 
26
26
  publisher.publish(:test_event)
27
27
 
28
- expect(result).to eql([:test_event])
28
+ expect(captured).to eql([:test_event])
29
+ end
30
+
31
+ describe 'filters' do
32
+ it 'filters events' do
33
+ listener.subscribe(:test_event, level: :info) do |event|
34
+ captured << event.payload
35
+ end
36
+
37
+ publisher.publish(:test_event)
38
+ publisher.publish(:test_event, level: :debug)
39
+ publisher.publish(:test_event, level: :info)
40
+
41
+ expect(captured).to eql([level: :info])
42
+ end
29
43
  end
30
44
  end
31
45
  end
@@ -39,6 +39,14 @@ RSpec.describe Dry::Events::Publisher do
39
39
 
40
40
  expect(publisher.subscribed?(listener)).to be(true)
41
41
  end
42
+
43
+ it 'raises an exception when subscribing to an unregister event' do
44
+ listener = -> * { }
45
+
46
+ expect {
47
+ publisher.subscribe(:not_register, &listener)
48
+ }.to raise_error(Dry::Events::InvalidSubscriberError, /not_register/)
49
+ end
42
50
  end
43
51
 
44
52
  describe '#register_event' do
@@ -83,6 +91,20 @@ RSpec.describe Dry::Events::Publisher do
83
91
 
84
92
  expect(listener.captured).to eql(['it works'])
85
93
  end
94
+
95
+ it 'raises an exception when subscribing with no methods to execute' do
96
+ listener = Object.new
97
+
98
+ expect {
99
+ publisher.subscribe(listener)
100
+ }.to raise_error(Dry::Events::InvalidSubscriberError, /never be executed/)
101
+ end
102
+
103
+ it 'does not raise an exception when subscriber has methods for notification' do
104
+ listener = Object.new
105
+ def listener.on_test_event; nil; end
106
+ expect { publisher.subscribe(listener) }.not_to raise_error
107
+ end
86
108
  end
87
109
 
88
110
  describe '#publish' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-events
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-02 00:00:00.000000000 Z
11
+ date: 2019-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -116,10 +116,13 @@ files:
116
116
  - lib/dry/events/bus.rb
117
117
  - lib/dry/events/constants.rb
118
118
  - lib/dry/events/event.rb
119
+ - lib/dry/events/filter.rb
119
120
  - lib/dry/events/listener.rb
120
121
  - lib/dry/events/publisher.rb
121
122
  - lib/dry/events/version.rb
122
123
  - spec/spec_helper.rb
124
+ - spec/unit/dry/events/event_spec.rb
125
+ - spec/unit/dry/events/filter_spec.rb
123
126
  - spec/unit/dry/events/listener_spec.rb
124
127
  - spec/unit/dry/events/publisher_spec.rb
125
128
  homepage: https://github.com/dry-rb/dry-events
@@ -141,12 +144,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
144
  - !ruby/object:Gem::Version
142
145
  version: '0'
143
146
  requirements: []
144
- rubyforge_project:
145
- rubygems_version: 2.7.3
147
+ rubygems_version: 3.0.3
146
148
  signing_key:
147
149
  specification_version: 4
148
150
  summary: Pub/sub system
149
151
  test_files:
150
152
  - spec/spec_helper.rb
153
+ - spec/unit/dry/events/event_spec.rb
154
+ - spec/unit/dry/events/filter_spec.rb
151
155
  - spec/unit/dry/events/listener_spec.rb
152
156
  - spec/unit/dry/events/publisher_spec.rb