Class: Rails::Plugin::Locator

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/rails/plugin/locator.rb

Overview

The Plugin::Locator class should be subclasses to provide custom plugin-finding abilities to Rails (i.e. loading plugins from Gems, etc). Each subclass should implement the located_plugins method, which return an array of Plugin objects that have been found.

Direct Known Subclasses

FileSystemLocator, GemLocator

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(initializer) ⇒ Locator

Returns a new instance of Locator.



12
13
14
# File 'lib/rails/plugin/locator.rb', line 12

def initialize(initializer)
  @initializer = initializer
end

Instance Attribute Details

#initializerObject (readonly)

Returns the value of attribute initializer.



10
11
12
# File 'lib/rails/plugin/locator.rb', line 10

def initializer
  @initializer
end

Instance Method Details

#each(&block) ⇒ Object



23
24
25
# File 'lib/rails/plugin/locator.rb', line 23

def each(&block)
  plugins.each(&block)
end

#plugin_namesObject



27
28
29
# File 'lib/rails/plugin/locator.rb', line 27

def plugin_names
  plugins.map(&:name)
end

#pluginsObject

This method should return all the plugins which this Plugin::Locator can find These will then be used by the current Plugin::Loader, which is responsible for actually loading the plugins themselves



19
20
21
# File 'lib/rails/plugin/locator.rb', line 19

def plugins
  raise "The `plugins' method must be defined by concrete subclasses of #{self.class}"
end