Class: Discordrb::Events::ServerRoleCreateEventHandler

Inherits:
EventHandler
  • Object
show all
Defined in:
lib/discordrb/events/roles.rb

Overview

Event handler for ServerRoleCreateEvent

Direct Known Subclasses

ServerRoleUpdateEventHandler

Instance Method Summary collapse

Methods inherited from EventHandler

#after_call, #call, #initialize, #match, #matches_all

Constructor Details

This class inherits a constructor from Discordrb::Events::EventHandler

Instance Method Details

#matches?(event) ⇒ Boolean


33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/discordrb/events/roles.rb', line 33

def matches?(event)
  # Check for the proper event type
  return false unless event.is_a? ServerRoleCreateEvent

  [
    matches_all(@attributes[:name], event.name) do |a, e|
      a == if a.is_a? String
             e.to_s
           else
             e
           end
    end
  ].reduce(true, &:&)
end