Module: Aux::Pluggable

Defined in:
lib/aux/pluggable.rb,
lib/aux/pluggable/connector.rb,
lib/aux/pluggable/utilities.rb,
lib/aux/pluggable/dependency.rb,
lib/aux/pluggable/class_methods.rb

Overview

Describes interface that makes any class able to register itself as well as resolve dependencies rubocop:disable Style/ClassVars

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

@@registry =
Aux::Registry.new

Class Method Summary collapse

Class Method Details

.configure {|pluggable, registry| ... } ⇒ Object

Yields:

  • configure the module

Yield Parameters:



28
29
30
# File 'lib/aux/pluggable.rb', line 28

def self.configure
  yield(self, @@registry) if block_given?
end

.included(base) ⇒ Object

Extends the including class with ClassMethods and initializes a new Connector instance

Parameters:

  • base (Class)

    the class that includes this module



17
18
19
20
21
22
23
# File 'lib/aux/pluggable.rb', line 17

def self.included(base)
  base.extend(ClassMethods)

  base.class_eval do
    @_pluggable = Connector.new(self, @@registry)
  end
end

.registryAux::Registry

Returns:



38
39
40
# File 'lib/aux/pluggable.rb', line 38

def self.registry
  @@registry
end

.registry=(registry) ⇒ Object

Parameters:



33
34
35
# File 'lib/aux/pluggable.rb', line 33

def self.registry=(registry)
  @@registry = registry
end