Sha256: f22d55fa7b90ed9e2cb7aa75c0840ea49e9ebc553771d5fdc0fd78554e6a28b7

Contents?: true

Size: 586 Bytes

Versions: 23

Compression:

Stored size: 586 Bytes

Contents

module Euston
  module CommandHandler
    extend ActiveSupport::Concern
    include Euston::CommandHandlerPrivateMethodNames

    module ClassMethods
      def version number, &consumer
        define_method command_handler_method_name(number) do |*args|
          if block_given?
            instance_exec *args, &consumer
          else
            publish args.shift, args.shift
          end
        end
      end
    end

    module InstanceMethods
      protected

      def publish headers, command
        Euston::CommandBus.publish headers, command
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
euston-1.2.0-java lib/euston/command_handler.rb
euston-1.1.0 lib/euston/command_handler.rb
euston-1.1.0-java lib/euston/command_handler.rb