Class: SocialWeb::Hooks::Registry

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRegistry

Returns a new instance of Registry.



55
56
57
# File 'lib/social_web/hooks.rb', line 55

def initialize
  @hooks = {}
end

Instance Attribute Details

#hooksObject

Returns the value of attribute hooks.



49
50
51
# File 'lib/social_web/hooks.rb', line 49

def hooks
  @hooks
end

Class Method Details

.instanceObject



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