Class: Discordrb::Events::EventHandler
- Inherits:
-
Object
- Object
- Discordrb::Events::EventHandler
show all
- Defined in:
- lib/discordrb/events/generic.rb
Overview
Generic event handler that can be extended
Direct Known Subclasses
AwaitEventHandler, ChannelCreateEventHandler, ChannelDeleteEventHandler, ChannelUpdateEventHandler, GuildEventHandler, GuildMemberEventHandler, GuildRoleCreateEventHandler, GuildRoleDeleteEventHandler, GuildRoleUpdateEventHandler, MessageEventHandler, MessageIDEventHandler, PlayingEventHandler, PresenceEventHandler, TrueEventHandler, TypingEventHandler, UserBanEventHandler, VoiceStateUpdateEventHandler
Instance Method Summary
collapse
Constructor Details
#initialize(attributes, block) ⇒ EventHandler
Returns a new instance of EventHandler.
35
36
37
38
|
# File 'lib/discordrb/events/generic.rb', line 35
def initialize(attributes, block)
@attributes = attributes
@block = block
end
|
Instance Method Details
#call(event) ⇒ Object
48
49
50
|
# File 'lib/discordrb/events/generic.rb', line 48
def call(event)
@block.call(event)
end
|
#match(event) ⇒ Object
44
45
46
|
# File 'lib/discordrb/events/generic.rb', line 44
def match(event)
call(event) if matches? event
end
|
#matches?(_) ⇒ Boolean
40
41
42
|
# File 'lib/discordrb/events/generic.rb', line 40
def matches?(_)
fail 'Attempted to call matches?() from a generic EventHandler'
end
|
#matches_all(attributes, to_check, &block) ⇒ Object
52
53
54
|
# File 'lib/discordrb/events/generic.rb', line 52
def matches_all(attributes, to_check, &block)
Discordrb::Events.matches_all(attributes, to_check, &block)
end
|