### Home Classes Methods

### In Files

- lib/phusion_passenger/plugin.rb

### Parent

Object

### Methods

- ::call_hook
- ::load
- ::new
- ::register
- ::register_hook
- #call_hook

### Class/Module Index

Quicksearch

- PhusionPassenger
- PhusionPassenger::AbstractInstaller
- PhusionPassenger::AbstractInstaller::Abort
- PhusionPassenger::AbstractInstaller::CommandError
- PhusionPassenger::AdminTools
- PhusionPassenger::AdminTools::MemoryStats
- PhusionPassenger::AdminTools::MemoryStats::Process
- PhusionPassenger::AdminTools::ServerInstance
- PhusionPassenger::AdminTools::ServerInstance::CorruptedDirectoryError
- PhusionPassenger::AdminTools::ServerInstance::GenerationsAbsentError
- PhusionPassenger::AdminTools::ServerInstance::Group
- PhusionPassenger::AdminTools::ServerInstance::Process
- PhusionPassenger::AdminTools::ServerInstance::RoleDeniedError
- PhusionPassenger::AdminTools::ServerInstance::StaleDirectoryError
- PhusionPassenger::AdminTools::ServerInstance::Stats
- PhusionPassenger::AdminTools::ServerInstance::UnsupportedGenerationStructureVersionError
- PhusionPassenger::AnalyticsLogger
- PhusionPassenger::AnalyticsLogger::Connection
- PhusionPassenger::AnalyticsLogger::Lock
- PhusionPassenger::AnalyticsLogger::Log
- PhusionPassenger::ClassicRails
- PhusionPassenger::ClassicRails::CGIFixed
- PhusionPassenger::ClassicRails::ThreadHandlerExtension
- PhusionPassenger::ConsoleTextTemplate
- PhusionPassenger::DebugLogging
- PhusionPassenger::LoaderSharedHelpers
- PhusionPassenger::MessageChannel
- PhusionPassenger::MessageChannel::InvalidHashError
- PhusionPassenger::MessageClient
- PhusionPassenger::NativeSupportLoader
- PhusionPassenger::Packaging
- PhusionPassenger::PlatformInfo
- PhusionPassenger::PlatformInfo::ApacheDetector
- PhusionPassenger::PlatformInfo::ApacheDetector::Result
- PhusionPassenger::PlatformInfo::Depcheck
- PhusionPassenger::PlatformInfo::Depcheck::ConsoleRunner
- PhusionPassenger::PlatformInfo::Depcheck::Dependency
- PhusionPassenger::PlatformInfo::RuntimeError
- PhusionPassenger::Plugin
- PhusionPassenger::PreloaderSharedHelpers
- PhusionPassenger::Rack
- PhusionPassenger::Rack::OutOfBandGc
- PhusionPassenger::Rack::ThreadHandlerExtension
- PhusionPassenger::Rails3Extensions
- PhusionPassenger::Rails3Extensions::AnalyticsLogging
- PhusionPassenger::Rails3Extensions::AnalyticsLogging::ACExtension
- PhusionPassenger::Rails3Extensions::AnalyticsLogging::ASBenchmarkableExtension
- PhusionPassenger::Rails3Extensions::AnalyticsLogging::ExceptionLogger
- PhusionPassenger::RequestHandler
- PhusionPassenger::RequestHandler::ThreadHandler
- PhusionPassenger::RequestHandler::ThreadHandler::Interrupted
- PhusionPassenger::SharedConstants
- PhusionPassenger::Standalone
- PhusionPassenger::Standalone::AppFinder
- PhusionPassenger::Standalone::Command
- PhusionPassenger::Standalone::ConfigFile
- PhusionPassenger::Standalone::ConfigFile::DisallowedContextError
- PhusionPassenger::Standalone::HelpCommand
- PhusionPassenger::Standalone::Main
- PhusionPassenger::Standalone::PackageRuntimeCommand
- PhusionPassenger::Standalone::RuntimeInstaller
- PhusionPassenger::Standalone::RuntimeLocator
- PhusionPassenger::Standalone::StartCommand
- PhusionPassenger::Standalone::StatusCommand
- PhusionPassenger::Standalone::StopCommand
- PhusionPassenger::Standalone::Utils
- PhusionPassenger::Standalone::VersionCommand
- PhusionPassenger::Utils
- PhusionPassenger::Utils::AnsiColors
- PhusionPassenger::Utils::FileSystemWatcher
- PhusionPassenger::Utils::FileSystemWatcher::DirInfo
- PhusionPassenger::Utils::FileSystemWatcher::FileInfo
- PhusionPassenger::Utils::GeneratorTest
- PhusionPassenger::Utils::HostsFileParser
- PhusionPassenger::Utils::JSON
- PhusionPassenger::Utils::JSON::Generator
- PhusionPassenger::Utils::ParserTest
- PhusionPassenger::Utils::TeeInput
- PhusionPassenger::Utils::TmpIO
- PhusionPassenger::Utils::UnseekableSocket
- CommonLibraryBuilder
- Exception
- GC
- IO
- Object
- Signal

No matching classes.

# PhusionPassenger::Plugin

### Public Class Methods

call_hook(name, *args, &block) click to toggle source

    # File lib/phusion_passenger/plugin.rb, line 56
    def self.call_hook(name, *args, &block)
            last_result = nil
            if (hooks_list = @@hooks[name])
                    hooks_list.each do |callback|
                            last_result = callback.call(*args, &block)
                    end
            end
            return last_result
    end

load(name, load_once = true) click to toggle source

    # File lib/phusion_passenger/plugin.rb, line 33
    def self.load(name, load_once = true)
            PLUGIN_DIRS.each do |plugin_dir|
                    if plugin_dir =~ /\A~/
                            # File.expand_path uses ENV['HOME'] which we don't want.
                            home = Etc.getpwuid(Process.uid).dir
                            plugin_dir = plugin_dir.sub(/\A~/, home)
                    end
                    plugin_dir = File.expand_path(plugin_dir)
                    Dir["#{plugin_dir}/*/#{name}.rb"].each do |filename|
                            if load_once
                                    require(filename)
                            else
                                    load(filename)
                            end
                    end
            end
    end

new(name, *args, &block) click to toggle source

    # File lib/phusion_passenger/plugin.rb, line 71
    def initialize(name, *args, &block)
            Plugin.load(name)
            classes = @@classes[name]
            if classes
                    @instances = classes.map do |klass|
                            klass.new(*args, &block)
                    end
            else
                    return nil
            end
    end

register(name, klass) click to toggle source

    # File lib/phusion_passenger/plugin.rb, line 66
    def self.register(name, klass)
            classes = (@@classes[name] ||= [])
            classes << klass
    end

register_hook(name, &block) click to toggle source

    # File lib/phusion_passenger/plugin.rb, line 51
    def self.register_hook(name, &block)
            hooks_list = (@@hooks[name] ||= [])
            hooks_list << block
    end

### Public Instance Methods

call_hook(name, *args, &block) click to toggle source

    # File lib/phusion_passenger/plugin.rb, line 83
    def call_hook(name, *args, &block)
            last_result = nil
            if @instances
                    @instances.each do |instance|
                            if instance.respond_to?(name.to_sym)
                                    last_result = instance.__send__(name.to_sym, *args, &block)
                            end
                    end
            end
            return last_result
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.