class Jekyll::Plugin

Constants

PRIORITIES

Public Class Methods

<=>(other) click to toggle source

Spaceship is priority [higher -> lower]

other - The class to be compared.

Returns -1, 0, 1.

# File lib/jekyll/plugin.rb, line 55
def self.<=>(other)
  PRIORITIES[other.priority] <=> PRIORITIES[self.priority]
end
descendants() click to toggle source

Fetch all the subclasses of this class and its subclasses' subclasses.

Returns an array of descendant classes.

# File lib/jekyll/plugin.rb, line 12
def self.descendants
  descendants = []
  ObjectSpace.each_object(singleton_class) do |k|
    descendants.unshift k unless k == self
  end
  descendants
end
new(config = {}) click to toggle source

Initialize a new plugin. This should be overridden by the subclass.

config - The Hash of configuration options.

Returns a new instance.

# File lib/jekyll/plugin.rb, line 73
def initialize(config = {})
  # no-op for default
end
priority(priority = nil) click to toggle source

Get or set the priority of this plugin. When called without an argument it returns the priority. When an argument is given, it will set the priority.

priority - The Symbol priority (default: nil). Valid options are:

:lowest, :low, :normal, :high, :highest

Returns the Symbol priority.

# File lib/jekyll/plugin.rb, line 28
def self.priority(priority = nil)
  @priority ||= nil
  if priority && PRIORITIES.key?(priority)
    @priority = priority
  end
  @priority || :normal
end
safe(safe = nil) click to toggle source

Get or set the safety of this plugin. When called without an argument it returns the safety. When an argument is given, it will set the safety.

safe - The Boolean safety (default: nil).

Returns the safety Boolean.

# File lib/jekyll/plugin.rb, line 43
def self.safe(safe = nil)
  if safe
    @safe = safe
  end
  @safe || false
end

Public Instance Methods

<=>(other) click to toggle source

Spaceship is priority [higher -> lower]

other - The class to be compared.

Returns -1, 0, 1.

# File lib/jekyll/plugin.rb, line 64
def <=>(other)
  self.class <=> other.class
end