Class: ActivityPub::Hooks::Registry

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRegistry

Returns a new instance of Registry.



64
65
66
# File 'lib/activity_pub/hooks.rb', line 64

def initialize
  @hooks = {}
end

Instance Attribute Details

#hooksObject

Returns the value of attribute hooks.



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

def hooks
  @hooks
end

Class Method Details

.instanceObject



60
61
62
# File 'lib/activity_pub/hooks.rb', line 60

def self.instance
  @instance ||= new
end

Instance Method Details

#[](name) ⇒ Object



68
69
70
# File 'lib/activity_pub/hooks.rb', line 68

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

#register(name, &action) ⇒ Object



72
73
74
75
# File 'lib/activity_pub/hooks.rb', line 72

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