module Plugg

Public Class Methods

registry() click to toggle source

Get the current registry

@return array

# File lib/plugg.rb, line 46
def Plugg.registry
  Dispatcher.instance.registry
end
send(evt, params = {}) click to toggle source

Send an event to the plugin registry

@param symbol evt @param hash params @return mixed

# File lib/plugg.rb, line 56
def Plugg.send(evt, params = {})
  Dispatcher.instance.on(evt.to_sym, params)
end
source(path, params = {}) click to toggle source

Set the source directory to load the plugins & dependencies from

@param hash params @param mixed path

# File lib/plugg.rb, line 11
def Plugg.source(path, params = {})

  load_path = []

  if !path.kind_of?(Array)
    if File.directory?(path)
      load_path << path
    end
  else
    path.select! do |p|
      File.directory?(p)
    end

    load_path.concat(path)
  end

  if load_path.empty?
    raise 'Unable to locate plugins in the provided load paths'
  end

  Dispatcher.instance.start(load_path, params)
end
timeout(t = 30) click to toggle source

Set the dispatch plugin timeout value

@param integer t

# File lib/plugg.rb, line 38
def Plugg.timeout(t = 30)
  Dispatcher.instance.set_timeout(t)
end