Module: SocialWeb::Hooks
- Defined in:
- lib/social_web/hooks.rb
Defined Under Namespace
Classes: FailedHook, Registry
Class Method Summary
collapse
Class Method Details
.register(name, &action) ⇒ Object
37
38
39
|
# File 'lib/social_web/hooks.rb', line 37
def self.register(name, &action)
Registry.instance.register(name, &action)
end
|
.run(name, *args, **kwargs) ⇒ Object
41
42
43
44
45
46
|
# File 'lib/social_web/hooks.rb', line 41
def self.run(name, *args, **kwargs)
hook = Registry.instance[name]
hook&.call(*args, **kwargs)
rescue StandardError => e
raise FailedHook.new(name, hook.source_location, e)
end
|