Class: WellKnown::Hooks::Registry

Inherits:
Object
  • Object
show all
Defined in:
lib/well_known/hooks.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRegistry

Returns a new instance of Registry.



62
63
64
# File 'lib/well_known/hooks.rb', line 62

def initialize
  @hooks = {}
end

Instance Attribute Details

#hooksObject

Returns the value of attribute hooks.



56
57
58
# File 'lib/well_known/hooks.rb', line 56

def hooks
  @hooks
end

Class Method Details

.instanceObject



58
59
60
# File 'lib/well_known/hooks.rb', line 58

def self.instance
  @instance ||= new
end

Instance Method Details

#[](name) ⇒ Object



66
67
68
# File 'lib/well_known/hooks.rb', line 66

def [](name)
  @hooks[name]
end

#register(name, &action) ⇒ Object



70
71
72
73
# File 'lib/well_known/hooks.rb', line 70

def register(name, &action)
  @hooks[name] ||= []
  @hooks[name] << action.to_proc
end