class Epuber::Plugin::PluginFile

Attributes

instances[R]

@return [Array]

Public Class Methods

new(file_path) click to toggle source

@param [String] relative_path path to plugin file (relative to project root)

# File lib/epuber/plugin.rb, line 17
def initialize(file_path)
  super(file_path)
  @instances = []

  eval(::File.read(file_path), binding, file_path) # rubocop:disable Security/Eval
end
plugin_instance_function(name, klass) click to toggle source

@param [Symbol] name name of the plugin function @param [Class] klass class of what it should create

@return nil

# File lib/epuber/plugin.rb, line 29
def self.plugin_instance_function(name, klass)
  define_method(name) do |source_type, *options, &block|
    checker_class = klass.class_for_source_type(source_type)
    checker = checker_class.new(source_type, *options, &block)
    instances << checker
    checker
  end
end