module PhobosDBCheckpoint::EventHelper

Public Instance Methods

configured_handler() click to toggle source
# File lib/phobos_db_checkpoint/event_helper.rb, line 16
def configured_handler
  configured_listener
    .handler
    .constantize
end
configured_listener() click to toggle source
# File lib/phobos_db_checkpoint/event_helper.rb, line 5
def configured_listener
  listener = Phobos
             .config
             .listeners
             .find { |l| l.group_id == group_id }

  raise(ListenerNotFoundError, group_id) unless listener

  listener
end
method_missing(method_name, *args, &block) click to toggle source
Calls superclass method
# File lib/phobos_db_checkpoint/event_helper.rb, line 22
def method_missing(method_name, *args, &block)
  if method_name.to_s =~ /^fetch_(.*)/
    method = Regexp.last_match(1)
    handler = configured_handler.new
    handler.send(method, payload) if handler.respond_to?(method)
  else
    super
  end
end
respond_to_missing?(method_name, include_private = false) click to toggle source
Calls superclass method
# File lib/phobos_db_checkpoint/event_helper.rb, line 32
def respond_to_missing?(method_name, include_private = false)
  method_name.to_s.start_with?('fetch_') || super
end