Class: ActivityPub::Hooks::Registry
- Inherits:
-
Object
- Object
- ActivityPub::Hooks::Registry
- Defined in:
- lib/activity_pub/hooks.rb
Instance Attribute Summary collapse
-
#hooks ⇒ Object
Returns the value of attribute hooks.
Class Method Summary collapse
Instance Method Summary collapse
- #[](name) ⇒ Object
-
#initialize ⇒ Registry
constructor
A new instance of Registry.
- #register(name, &action) ⇒ Object
Constructor Details
#initialize ⇒ Registry
Returns a new instance of Registry.
64 65 66 |
# File 'lib/activity_pub/hooks.rb', line 64 def initialize @hooks = {} end |
Instance Attribute Details
#hooks ⇒ Object
Returns the value of attribute hooks.
58 59 60 |
# File 'lib/activity_pub/hooks.rb', line 58 def hooks @hooks end |
Class Method Details
.instance ⇒ Object
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 |