Method: Doing::Plugins.validate_plugin

Defined in:
lib/doing/plugin_manager.rb

.validate_plugin(title, type, klass) ⇒ Object



84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/doing/plugin_manager.rb', line 84

def validate_plugin(title, type, klass)
  type = valid_type(type)
  if type == :import && !klass.respond_to?(:import)
    raise Errors::PluginUncallable.new('Import plugins must respond to :import', type: type, plugin: title)
  end

  if type == :export && !klass.respond_to?(:render)
    raise Errors::PluginUncallable.new('Export plugins must respond to :render', type: type, plugin: title)
  end

  type
end