Files

Thoth::Plugin

Namespace for Thoth plugins. See code.google.com/p/thoth-blog/wiki/CreatingPlugins for more info on creating and using plugins.

Public Class Methods

const_missing(name) click to toggle source
# File lib/thoth/plugin.rb, line 35
def self.const_missing(name)
  self.load(name)
  self.const_get(name)
end
load(name) click to toggle source

Attempts to load the specified plugin, first from Thoth's /plugin directory, then as a gem.

# File lib/thoth/plugin.rb, line 42
def self.load(name)
  plugin = "thoth_#{name.to_s.downcase.gsub(/^thoth_/, '')}"
  files  = Dir["{#{HOME_DIR/:plugin},#{LIB_DIR/:plugin}," <<
      "#{$:.join(',')}}/#{plugin}.rb"]

  # First try to load a local copy of the plugin, then try the gem.
  unless (files.any? && require(files.first)) || require(plugin)
    raise LoadError, "Thoth::Plugin::#{name} not found"
  end

  Ramaze::Log.info "Loaded plugin: #{plugin}"

  true
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.