<commit_before>require 'discordrb/events/utility'

module Discordrb::Events
  class EventHandler
    include Discordrb::Events::Utility
    def initialize(attributes, block)
      @attributes = attributes
      @block = block
    end

    def matches?(event)
      raise "Attempted to call matches?() from a generic EventHandler"
    end

    def match(event)
      @block.call(event) if matches? event
    end
  end
end
<commit_msg>Add a generic event handler that matches all events<commit_after>require 'discordrb/events/utility'

module Discordrb::Events
  class EventHandler
    include Discordrb::Events::Utility
    def initialize(attributes, block)
      @attributes = attributes
      @block = block
    end

    def matches?(event)
      raise "Attempted to call matches?() from a generic EventHandler"
    end

    def match(event)
      @block.call(event) if matches? event
    end
  end

  # Event handler that matches all events
  class TrueEventHandler < EventHandler
    def matches?(event)
      true
    end
  end
end

{'fraction_non_alphanumeric': 0.07239382239382239, 'fraction_numerical': 0.0, 'mean_word_length': 3.181451612903226, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '904010', 'n_tokens_mistral': 293, 'n_tokens_neox': 291, 'n_words': 96}