Sha256: e80bfad8b310c1a465b4a4126573669fe2e66891dc643ca3bcda483fec9fa10a

Contents?: true

Size: 1.21 KB

Versions: 55

Compression:

Stored size: 1.21 KB

Contents

module KnapsackPro
  module Hooks
    class Queue
      class << self
        attr_reader :before_queue,
          :after_subset_queue,
          :after_queue

        def reset_before_queue
          @before_queue = nil
        end

        def reset_after_subset_queue
          @after_subset_queue = nil
        end

        def reset_after_queue
          @after_queue = nil
        end

        def before_queue(&block)
          @before_queue ||= block
        end

        def after_subset_queue(&block)
          @after_subset_queue ||= block
        end

        def after_queue(&block)
          @after_queue ||= block
        end

        def call_before_queue
          return unless before_queue
          before_queue.call(
            KnapsackPro::Config::Env.queue_id
          )
        end

        def call_after_subset_queue
          return unless after_subset_queue
          after_subset_queue.call(
            KnapsackPro::Config::Env.queue_id,
            KnapsackPro::Config::Env.subset_queue_id
          )
        end

        def call_after_queue
          return unless after_queue
          after_queue.call(
            KnapsackPro::Config::Env.queue_id
          )
        end
      end
    end
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
knapsack_pro-2.1.1 lib/knapsack_pro/hooks/queue.rb
knapsack_pro-2.1.0 lib/knapsack_pro/hooks/queue.rb
knapsack_pro-2.0.0 lib/knapsack_pro/hooks/queue.rb
knapsack_pro-1.22.3 lib/knapsack_pro/hooks/queue.rb
knapsack_pro-1.22.2 lib/knapsack_pro/hooks/queue.rb
knapsack_pro-1.22.1 lib/knapsack_pro/hooks/queue.rb
knapsack_pro-1.22.0 lib/knapsack_pro/hooks/queue.rb
knapsack_pro-1.21.0 lib/knapsack_pro/hooks/queue.rb
knapsack_pro-1.20.2 lib/knapsack_pro/hooks/queue.rb
knapsack_pro-1.20.1 lib/knapsack_pro/hooks/queue.rb
knapsack_pro-1.20.0 lib/knapsack_pro/hooks/queue.rb
knapsack_pro-1.19.0 lib/knapsack_pro/hooks/queue.rb
knapsack_pro-1.18.2 lib/knapsack_pro/hooks/queue.rb
knapsack_pro-1.18.1 lib/knapsack_pro/hooks/queue.rb
knapsack_pro-1.18.0 lib/knapsack_pro/hooks/queue.rb
knapsack_pro-1.17.0 lib/knapsack_pro/hooks/queue.rb
knapsack_pro-1.16.1 lib/knapsack_pro/hooks/queue.rb
knapsack_pro-1.16.0 lib/knapsack_pro/hooks/queue.rb
knapsack_pro-1.15.0 lib/knapsack_pro/hooks/queue.rb
knapsack_pro-1.14.0 lib/knapsack_pro/hooks/queue.rb