Class: SlackRubyBot::Hooks::Set
- Inherits:
-
Object
- Object
- SlackRubyBot::Hooks::Set
- Defined in:
- lib/slack-ruby-bot/hooks/set.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#handlers ⇒ Object
Returns the value of attribute handlers.
Instance Method Summary collapse
- #add(hook_name, handler) ⇒ Object
-
#initialize(client = nil) ⇒ Set
constructor
A new instance of Set.
Constructor Details
#initialize(client = nil) ⇒ Set
Returns a new instance of Set.
8 9 10 11 12 13 |
# File 'lib/slack-ruby-bot/hooks/set.rb', line 8 def initialize(client = nil) self.handlers = {} self.client = client @pending_flush = client.blank? end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
6 7 8 |
# File 'lib/slack-ruby-bot/hooks/set.rb', line 6 def client @client end |
#handlers ⇒ Object
Returns the value of attribute handlers.
6 7 8 |
# File 'lib/slack-ruby-bot/hooks/set.rb', line 6 def handlers @handlers end |
Instance Method Details
#add(hook_name, handler) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/slack-ruby-bot/hooks/set.rb', line 15 def add(hook_name, handler) handlers[hook_name] ||= ::Set.new handlers[hook_name] << handler register_callback(hook_name) end |