Class: Twitch::Bot::EventHandler
- Inherits:
-
Object
- Object
- Twitch::Bot::EventHandler
- Defined in:
- lib/twitch/bot/event_handler.rb
Overview
Handles a message of a specific type
Direct Known Subclasses
Client::AuthenticatedHandler, Client::ModeHandler, Client::PingHandler, CommandHandler
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#event ⇒ Object
readonly
Returns the value of attribute event.
Class Method Summary collapse
-
.handled_events ⇒ Array
Return a list of event types this handler subscribes to.
Instance Method Summary collapse
-
#call ⇒ Object
Handle the event.
-
#initialize(event:, client:) ⇒ EventHandler
constructor
Inititalize an event handler object.
Constructor Details
#initialize(event:, client:) ⇒ EventHandler
Inititalize an event handler object
24 25 26 27 |
# File 'lib/twitch/bot/event_handler.rb', line 24 def initialize(event:, client:) @event = event @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/twitch/bot/event_handler.rb', line 7 def client @client end |
#event ⇒ Object (readonly)
Returns the value of attribute event.
7 8 9 |
# File 'lib/twitch/bot/event_handler.rb', line 7 def event @event end |
Class Method Details
.handled_events ⇒ Array
Return a list of event types this handler subscribes to
14 15 16 |
# File 'lib/twitch/bot/event_handler.rb', line 14 def self.handled_events [] end |
Instance Method Details
#call ⇒ Object
Handle the event
34 35 36 |
# File 'lib/twitch/bot/event_handler.rb', line 34 def call raise "Unhandled #{event.type}" end |