class PublifyPlugins::Keeper

Constants

KINDS

Public Class Methods

available_plugins(kind = nil) click to toggle source
# File lib/publify_plugins.rb, line 33
def available_plugins(kind = nil)
  return @@registered.inspect unless kind

  check_kind(kind)
  @@registered[kind] || []
end
new() click to toggle source
# File lib/publify_plugins.rb, line 60
def initialize
  raise "No instance allowed."
end
register(klass) click to toggle source
# File lib/publify_plugins.rb, line 40
def register(klass)
  kind = klass.kind
  check_kind(kind)
  @@registered[kind] ||= []
  @@registered[kind] << klass
  @@registered[kind]
end

Private Class Methods

check_kind(kind) click to toggle source
# File lib/publify_plugins.rb, line 50
def check_kind(kind)
  unless KINDS.include?(kind)
    raise ArgumentError,
          "#{kind} is not part of available plugin targets (#{KINDS.join(",")})"
  end
end