Sha256: 21e0292beaf5f9fd07a757a840cb680f81d4883b2889a4e5907af9f53f7a22e8

Contents?: true

Size: 647 Bytes

Versions: 2

Compression:

Stored size: 647 Bytes

Contents

require 'qs/message_handler'

module Qs

  module EventHandler

    def self.included(klass)
      klass.class_eval do
        include Qs::MessageHandler
        include InstanceMethods
      end
    end

    module InstanceMethods

      def inspect
        reference = '0x0%x' % (self.object_id << 1)
        "#<#{self.class}:#{reference} @event=#{event.inspect}>"
      end

      private

      # Helpers

      def event;              @qs_runner.message; end
      def event_channel;      event.channel;      end
      def event_name;         event.name;         end
      def event_published_at; event.published_at; end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qs-0.5.0 lib/qs/event_handler.rb
qs-0.4.0 lib/qs/event_handler.rb