class Discordrb::Events::RawEventHandler

Event handler for {RawEvent}

Public Instance Methods

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

  [
    matches_all(@attributes[:type] || @attributes[:t], event.type) do |a, e|
      if a.is_a? Regexp
        a.match?(e)
      else
        e.to_s.casecmp(a.to_s).zero?
      end
    end
  ].reduce(true, &:&)
end