Class: WellKnown::Hooks::Registry
- Inherits:
-
Object
- Object
- WellKnown::Hooks::Registry
- Defined in:
- lib/well_known/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.
62 63 64 |
# File 'lib/well_known/hooks.rb', line 62 def initialize @hooks = {} end |
Instance Attribute Details
#hooks ⇒ Object
Returns the value of attribute hooks.
56 57 58 |
# File 'lib/well_known/hooks.rb', line 56 def hooks @hooks end |
Class Method Details
.instance ⇒ Object
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 |