module Diecut

Attributes

issue_handler[W]

Public Class Methods

clear_plugins() click to toggle source
# File lib/diecut.rb, line 28
def clear_plugins
  @plugin_loader = nil
end
issue_handler() click to toggle source
# File lib/diecut.rb, line 40
def issue_handler
  @issue_handler ||= ErrorHandling::AllWarn.new
end
kinds() click to toggle source
# File lib/diecut.rb, line 45
def kinds
  plugins.reduce([]) do |list, plugin|
    list + plugin.kinds
  end.uniq
end
load_plugins(prerelease = false) click to toggle source
# File lib/diecut.rb, line 32
def load_plugins(prerelease = false)
  plugin_loader.load_plugins(prerelease)
end
mediator(kind) click to toggle source
# File lib/diecut.rb, line 51
def mediator(kind)
  Mediator.new.tap do |med|
    plugins.each do |plug|
      next unless plug.has_kind?(kind)
      med.add_plugin(plug, plug.default_activated_for(kind))
    end
  end
end
plugin(name, &block) click to toggle source

Used in a ‘diecut_plugin.rb` file (either in the `lib/` of a gem, or at the local `~/.config/diecut/diecut_plugin.rb` to register a new plugin.

@param name [String, Symbol]

Names the plugin so that it can be toggled  later

@yieldparam description [PluginDescription]

The description object to configure the plugin with.
# File lib/diecut.rb, line 16
def plugin(name, &block)
  plugin_loader.describe_plugin(name, &block)
end
plugin_loader() click to toggle source
# File lib/diecut.rb, line 20
def plugin_loader
  @plugin_loader ||= PluginLoader.new
end
plugin_loader=(loader) click to toggle source
# File lib/diecut.rb, line 24
def plugin_loader=(loader)
  @plugin_loader = loader
end
plugins() click to toggle source
# File lib/diecut.rb, line 36
def plugins
  plugin_loader.plugins
end