Sha256: 22b1abb0c8b72cd5334746437672d6170d4917f8e9d9df99688cd663b6c80299

Contents?: true

Size: 696 Bytes

Versions: 16

Compression:

Stored size: 696 Bytes

Contents

# Copyright (c) 2015 Sqreen. All Rights Reserved.
# Please refer to our terms for more information: https://www.sqreen.io/terms.html

module Sqreen
  module Dependency
    class Callback
      attr_reader :name

      def initialize(name = nil, &block)
        @name = name
        @block = block
        @disabled = false
      end

      def call(*args, &block)
        Sqreen.log.debug "[#{Process.pid}] Callback #{@name} disabled:#{disabled?}"
        return if @disabled
        @block.call(*args, &block)
      end

      def disable
        @disabled = true
      end

      def enable
        @disabled = false
      end

      def disabled?
        @disabled
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
sqreen-1.18.1-java lib/sqreen/dependency/callback.rb
sqreen-1.18.1 lib/sqreen/dependency/callback.rb
sqreen-1.18.0-java lib/sqreen/dependency/callback.rb
sqreen-1.18.0 lib/sqreen/dependency/callback.rb
sqreen-1.17.2-java lib/sqreen/dependency/callback.rb
sqreen-1.17.2 lib/sqreen/dependency/callback.rb
sqreen-1.17.2.rc1-java lib/sqreen/dependency/callback.rb
sqreen-1.17.2.rc1 lib/sqreen/dependency/callback.rb
sqreen-1.17.2.beta4-java lib/sqreen/dependency/callback.rb
sqreen-1.17.2.beta4 lib/sqreen/dependency/callback.rb
sqreen-1.17.2.beta3-java lib/sqreen/dependency/callback.rb
sqreen-1.17.2.beta3 lib/sqreen/dependency/callback.rb
sqreen-1.17.2.beta2-java lib/sqreen/dependency/callback.rb
sqreen-1.17.2.beta2 lib/sqreen/dependency/callback.rb
sqreen-1.17.2.beta1-java lib/sqreen/dependency/callback.rb
sqreen-1.17.2.beta1 lib/sqreen/dependency/callback.rb