Class: RubyEventStore::SyncScheduler
- Inherits:
-
Object
- Object
- RubyEventStore::SyncScheduler
- Defined in:
- lib/ruby_event_store/sync_scheduler.rb
Direct Known Subclasses
Constant Summary collapse
- DEPRECATION_MESSAGE =
<<~EOW DEPRECATION WARNING: Passing a class as a subscriber is deprecated and will be removed in the next major release. Pass an instance or lambda instead, e.g. subscribe(MyHandler.new, to: [MyEvent]). EOW
Instance Method Summary collapse
Instance Method Details
#call(subscriber, event, _) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/ruby_event_store/sync_scheduler.rb', line 10 def call(subscriber, event, _) if Class === subscriber warn DEPRECATION_MESSAGE subscriber = subscriber.new end subscriber.call(event) end |
#verify(subscriber) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ruby_event_store/sync_scheduler.rb', line 18 def verify(subscriber) if Class === subscriber warn DEPRECATION_MESSAGE begin subscriber.new.respond_to?(:call) rescue ArgumentError false end else subscriber.respond_to?(:call) end end |