Class: Railjet::Listener

Inherits:
Object
  • Object
show all
Includes:
Util::UseCaseHelper
Defined in:
lib/railjet/bus.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.listen_to(event, &block) ⇒ Object



52
53
54
55
# File 'lib/railjet/bus.rb', line 52

def listen_to(event, &block)
  subscriptions << event
  define_listeners(event, &block)
end

.sidekiq_options(options = {}) ⇒ Object



57
58
59
60
61
62
63
# File 'lib/railjet/bus.rb', line 57

def sidekiq_options(options = {})
  if options.present?
    self.sidekiq_options_hash = self.sidekiq_options_hash.merge(options.stringify_keys)
  else
    self.sidekiq_options_hash
  end
end

.subscriptionsObject



48
49
50
# File 'lib/railjet/bus.rb', line 48

def subscriptions
  @subscriptions ||= []
end

Instance Method Details

#around_listener(event, **kwargs) {|kwargs| ... } ⇒ Object

This around block does nothing but it’s there as point of extensions so it could be easily overridden in sub-class if some additional setup is needed

Yields:

  • (kwargs)


93
94
95
# File 'lib/railjet/bus.rb', line 93

def around_listener(event, **kwargs)
  yield(**kwargs)
end