Class: Hooksmith::Config::Provider

Inherits:
Object
  • Object
show all
Defined in:
lib/hooksmith/config/provider.rb

Overview

Provider is used internally by the DSL to collect processor registrations.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provider) ⇒ Provider

Returns a new instance of Provider.



12
13
14
15
# File 'lib/hooksmith/config/provider.rb', line 12

def initialize(provider)
  @provider = provider
  @entries = []
end

Instance Attribute Details

#entriesArray<Hash> (readonly)

Returns list of entries registered.

Returns:

  • (Array<Hash>)

    list of entries registered.



10
11
12
# File 'lib/hooksmith/config/provider.rb', line 10

def entries
  @entries
end

#providerSymbol, String (readonly)

Returns the provider name.

Returns:

  • (Symbol, String)

    the provider name.



8
9
10
# File 'lib/hooksmith/config/provider.rb', line 8

def provider
  @provider
end

Instance Method Details

#register(event, processor_class_name) ⇒ Object

Registers a processor for a specific event.

Parameters:

  • event (Symbol, String)

    the event name.

  • processor_class_name (String)

    the processor class name.



21
22
23
# File 'lib/hooksmith/config/provider.rb', line 21

def register(event, processor_class_name)
  entries << { event: event.to_sym, processor: processor_class_name }
end