Class: DiscordRDA::EventHandler
- Inherits:
-
Object
- Object
- DiscordRDA::EventHandler
- Defined in:
- lib/discord_rda/event/base.rb
Overview
Handler interface for events
Instance Attribute Summary collapse
-
#block ⇒ Proc
readonly
Handler block.
Instance Method Summary collapse
-
#call(event) ⇒ Object
Call the handler.
-
#handles?(event) ⇒ Boolean
Check if handler responds to event.
-
#initialize(block) ⇒ EventHandler
constructor
Initialize handler.
Constructor Details
#initialize(block) ⇒ EventHandler
Initialize handler
65 66 67 |
# File 'lib/discord_rda/event/base.rb', line 65 def initialize(block) @block = block end |
Instance Attribute Details
#block ⇒ Proc (readonly)
Returns Handler block.
61 62 63 |
# File 'lib/discord_rda/event/base.rb', line 61 def block @block end |
Instance Method Details
#call(event) ⇒ Object
Call the handler
72 73 74 |
# File 'lib/discord_rda/event/base.rb', line 72 def call(event) @block.call(event) end |
#handles?(event) ⇒ Boolean
Check if handler responds to event
79 80 81 |
# File 'lib/discord_rda/event/base.rb', line 79 def handles?(event) true end |