Sha256: 9b9c44afb7b8fd9c0090c16af2e56e13daaa277f3990bcd30c5b0e947796eb88

Contents?: true

Size: 456 Bytes

Versions: 9

Compression:

Stored size: 456 Bytes

Contents

module LambdaPunch
  class Queue

    class << self

      def push(block)
        jobs << block
      end

      def jobs
        @jobs ||= Concurrent::Array.new
      end

    end

    def call
      jobs.each do |job| 
        begin
          job.call
        rescue => e
          LambdaPunch.error_handler.call(e)
        end
      end
      true
    ensure
      jobs.clear
    end

    private

    def jobs
      self.class.jobs
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
lambda_punch-1.1.4 lib/lambda_punch/queue.rb
lambda_punch-1.1.3 lib/lambda_punch/queue.rb
lambda_punch-1.1.2 lib/lambda_punch/queue.rb
lambda_punch-1.1.1 lib/lambda_punch/queue.rb
lambda_punch-1.1.0 lib/lambda_punch/queue.rb
lambda_punch-1.0.3 lib/lambda_punch/queue.rb
lambda_punch-1.0.2 lib/lambda_punch/queue.rb
lambda_punch-1.0.1 lib/lambda_punch/queue.rb
lambda_punch-1.0.0 lib/lambda_punch/queue.rb