Sha256: bf9baa637a9098709d59ebfb66c92a2cdc233095375492e72b21e4d32046eb06

Contents?: true

Size: 1.02 KB

Versions: 20

Compression:

Stored size: 1.02 KB

Contents

module OverSIP

  # This module is intended for 3rd party modules that need custom code to be
  # executed when OverSIP is started, reloaded or terminated.
  #
  module SystemCallbacks

    extend ::OverSIP::Logger

    @log_id = "SystemCallbacks"

    class << self
      attr_reader :on_started_callbacks
      attr_reader :on_terminated_callbacks
      attr_reader :on_reload_callbacks
    end

    @on_started_callbacks = []
    @on_terminated_callbacks = []
    @on_reload_callbacks = []

    def self.on_started pr=nil, &bl
      block = pr || bl
      raise ::ArgumentError, "no block given"  unless block.is_a? ::Proc

      @on_started_callbacks << block
    end

    def self.on_terminated pr=nil, &bl
      block = pr || bl
      raise ::ArgumentError, "no block given"  unless block.is_a? ::Proc

      @on_terminated_callbacks << block
    end

    def self.on_reload pr=nil, &bl
      block = pr || bl
      raise ::ArgumentError, "no block given"  unless block.is_a? ::Proc

      @on_reload_callbacks << block
    end

  end

end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
oversip_p-1.0.2 lib/oversip/system_callbacks.rb
oversip_p-1.0.0 lib/oversip/system_callbacks.rb
oversip-2.0.4 lib/oversip/system_callbacks.rb
oversip-2.0.3 lib/oversip/system_callbacks.rb
oversip-2.0.2 lib/oversip/system_callbacks.rb
oversip-2.0.1 lib/oversip/system_callbacks.rb
oversip-2.0.0 lib/oversip/system_callbacks.rb
oversip-1.4.1 lib/oversip/system_callbacks.rb
oversip-1.4.0 lib/oversip/system_callbacks.rb
oversip-1.3.8 lib/oversip/system_callbacks.rb
oversip-1.3.7 lib/oversip/system_callbacks.rb
oversip-1.3.6 lib/oversip/system_callbacks.rb
oversip-1.3.5 lib/oversip/system_callbacks.rb
oversip-1.3.3 lib/oversip/system_callbacks.rb
oversip-1.3.2 lib/oversip/system_callbacks.rb
oversip-1.3.1 lib/oversip/system_callbacks.rb
oversip-1.3.0 lib/oversip/system_callbacks.rb
oversip-1.3.0.dev1 lib/oversip/system_callbacks.rb
oversip-1.2.1 lib/oversip/system_callbacks.rb
oversip-1.2.0 lib/oversip/system_callbacks.rb