paths |
Directory paths which contain legacy plugins. |
pipeline |
Runtime pipline. |
# File lib/yapra/legacy_plugin/compatible_mode_registry.rb, line 10 def initialize paths, pipeline self.legacy_plugins = {} paths.each do |folder| folder = Pathname.new(folder) Pathname.glob(File.join(folder, "**/*.rb")).sort.each do |file| module_name = file.relative_path_from(folder).to_s.gsub("/","::")[0..-4] begin legacy_plugins[ module_name ] = Yapra::LegacyPlugin::Base.new(pipeline, file) logger.debug "#{module_name} is loaded from #{file}" rescue LoadError => ex logger.warn "#{module_name} can't load, because: #{ex.message}" end end end end
load plugin from module name.
example:
registry = Yapra::LegacyPlugin::CompatibleModeRegistry.new(paths, pipeline) feed_load_plugin = registry.get('Feed::load')
# File lib/yapra/legacy_plugin/compatible_mode_registry.rb, line 38 def get module_name plugin = legacy_plugins[module_name] raise "#{module_name} is not registered." unless plugin plugin end
Generated with the Darkfish Rdoc Generator 2.