Class: SocialWeb::Hooks::Registry
- Inherits:
-
Object
- Object
- SocialWeb::Hooks::Registry
- Defined in:
- lib/social_web/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.
55 56 57 |
# File 'lib/social_web/hooks.rb', line 55 def initialize @hooks = {} end |
Instance Attribute Details
#hooks ⇒ Object
Returns the value of attribute hooks.
49 50 51 |
# File 'lib/social_web/hooks.rb', line 49 def hooks @hooks end |
Class Method Details
.instance ⇒ Object
51 52 53 |
# File 'lib/social_web/hooks.rb', line 51 def self.instance @instance ||= new end |
Instance Method Details
#[](name) ⇒ Object
59 60 61 |
# File 'lib/social_web/hooks.rb', line 59 def [](name) @hooks[name] end |
#register(name, &action) ⇒ Object
63 64 65 |
# File 'lib/social_web/hooks.rb', line 63 def register(name, &action) @hooks[name] = action.to_proc end |