class Discordrb::Events::ChannelCreateEventHandler

Event handler for ChannelCreateEvent

Public Instance Methods

matches?(event) click to toggle source
# File lib/discordrb/events/channels.rb, line 40
def matches?(event)
  # Check for the proper event type
  return false unless event.is_a? ChannelCreateEvent

  [
    matches_all(@attributes[:type], event.type) do |a, e|
      a == if a.is_a? String
             e.name
           else
             e
           end
    end,
    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