class Jekyll::Plugin
Constants
- PRIORITIES
Public Class Methods
Spaceship is priority [higher -> lower]
other - The class to be compared.
Returns -1, 0, 1.
# File lib/jekyll/plugin.rb, line 76 def self.<=>(other) PRIORITIES[other.priority] <=> PRIORITIES[self.priority] end
# File lib/jekyll/plugin.rb, line 23 def self.catch_inheritance(const) const.define_singleton_method :inherited do |const_| (@children ||= Set.new).add const_ if block_given? yield const_ end end end
# File lib/jekyll/plugin.rb, line 34 def self.descendants @children ||= Set.new out = @children.map(&:descendants) out << self unless superclass == Plugin Set.new(out).flatten end
# File lib/jekyll/plugin.rb, line 15 def self.inherited(const) return catch_inheritance(const) do |const_| catch_inheritance(const_) end end
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 94 def initialize(config = {}) # no-op for default end
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 49 def self.priority(priority = nil) @priority ||= nil if priority && PRIORITIES.key?(priority) @priority = priority end @priority || :normal end
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 64 def self.safe(safe = nil) unless defined?(@safe) && safe.nil? @safe = safe end @safe || false end
Public Instance Methods
Spaceship is priority [higher -> lower]
other - The class to be compared.
Returns -1, 0, 1.
# File lib/jekyll/plugin.rb, line 85 def <=>(other) self.class <=> other.class end