Sha256: 31b24b613958dc99e372c6545d158952ec4dc2cd3b7d4fd5a60c2717f9c90322

Contents?: true

Size: 903 Bytes

Versions: 6

Compression:

Stored size: 903 Bytes

Contents

require 'much-plugin'
require 'qs/message_handler'

module Qs

  module JobHandler
    include MuchPlugin

    plugin_included do
      include Qs::MessageHandler
      include InstanceMethods
    end

    module InstanceMethods

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

      private

      # Helpers

      def job;            @qs_runner.message; end
      def job_name;       job.name;           end
      def job_created_at; job.created_at;     end

    end

    module TestHelpers

      def self.included(klass)
        require 'qs/test_runner'
      end

      def test_runner(handler_class, args = nil)
        Qs::JobTestRunner.new(handler_class, args)
      end

      def test_handler(handler_class, args = nil)
        test_runner(handler_class, args).handler
      end

    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
qs-0.8.1 lib/qs/job_handler.rb
qs-0.8.0 lib/qs/job_handler.rb
qs-0.7.1 lib/qs/job_handler.rb
qs-0.7.0 lib/qs/job_handler.rb
qs-0.6.1 lib/qs/job_handler.rb
qs-0.6.0 lib/qs/job_handler.rb