Module: SlackRubyBot::Hooks::HookSupport
- Included in:
- Server
- Defined in:
- lib/slack-ruby-bot/hooks/hook_support.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #add_hook_handlers(handler_hash) ⇒ Object
- #flush_hook_blocks ⇒ Object
-
#hooks ⇒ Object
Instance stuff.
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 |
# File 'lib/slack-ruby-bot/hooks/hook_support.rb', line 4 def self.included(base) base.cattr_accessor :hook_blocks base.extend(ClassMethods) end |
Instance Method Details
#add_hook_handlers(handler_hash) ⇒ Object
30 31 32 33 34 |
# File 'lib/slack-ruby-bot/hooks/hook_support.rb', line 30 def add_hook_handlers(handler_hash) handler_hash.each do |hook, handlers| Array(handlers).each { |handler| hooks.add(hook, handler) } end end |
#flush_hook_blocks ⇒ Object
24 25 26 27 28 |
# File 'lib/slack-ruby-bot/hooks/hook_support.rb', line 24 def flush_hook_blocks return nil unless self.class.hook_blocks add_hook_handlers(self.class.hook_blocks) end |
#hooks ⇒ Object
Instance stuff
20 21 22 |
# File 'lib/slack-ruby-bot/hooks/hook_support.rb', line 20 def hooks @hooks ||= SlackRubyBot::Hooks::Set.new end |