Class: Yapra::LegacyPlugin::RegistryFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/yapra/legacy_plugin/registry_factory.rb

Overview

RegistryFactory is factory class for LegacyPluginRegistry.

LegacyPluginRegistry is created by mode.

If mode is compatible, this factory create a CompatibeModeRegistry.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(plugin_paths, mode = 'compatible') ⇒ RegistryFactory

plugin_paths

directory paths which are contains legacy plugins.

mode

‘compatible’ / ‘advance’



15
16
17
18
19
20
21
# File 'lib/yapra/legacy_plugin/registry_factory.rb', line 15

def initialize plugin_paths, mode = 'compatible'
  registry_name = "Yapra::LegacyPlugin::#{Yapra::Inflector.camelize(mode)}ModeRegistry"
  @registry_class = Yapra.load_class_constant(registry_name)
  raise "'#{mode}' mode is not supported." unless @registry_class
  
  @plugin_paths = plugin_paths
end

Instance Attribute Details

#plugin_pathsObject (readonly)

Returns the value of attribute plugin_paths.



10
11
12
# File 'lib/yapra/legacy_plugin/registry_factory.rb', line 10

def plugin_paths
  @plugin_paths
end

#registry_classObject (readonly)

Returns the value of attribute registry_class.



11
12
13
# File 'lib/yapra/legacy_plugin/registry_factory.rb', line 11

def registry_class
  @registry_class
end

Instance Method Details

#create(pipeline) ⇒ Object



23
24
25
26
27
# File 'lib/yapra/legacy_plugin/registry_factory.rb', line 23

def create pipeline
  registry = registry_class.new(plugin_paths, pipeline)
  pipeline.legacy_plugin_registry = registry
  registry
end