Sha256: ff3a64f60a7d7a4ea07f076470fe6a18e6d80fea9f225998dfb8b4fc8da0d9d0

Contents?: true

Size: 681 Bytes

Versions: 2

Compression:

Stored size: 681 Bytes

Contents

module Eventboss
  module Listener
    ACTIVE_LISTENERS = {}

    def self.included(base)
      base.extend ClassMethods
    end

    def jid
      @jid ||= SecureRandom.uuid
    end

    attr_reader :postponed_by

    def postpone_by(time_in_secs)
      @postponed_by = time_in_secs.to_i
    end

    module ClassMethods
      def eventboss_options(opts)
        source_app = opts[:source_app] ? "#{opts[:source_app]}-" : ""
        event_name = opts[:event_name]
        destination_app = opts[:destination_app]

        ACTIVE_LISTENERS["#{source_app}#{event_name}"] = {
          listener: self,
          destination_app: destination_app
        }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eventboss-1.3.1 lib/eventboss/listener.rb
eventboss-1.3.0 lib/eventboss/listener.rb