<commit_before>module Tribe
  module EM
    class Connection < ::EM::Connection
      include Tribe::Actable

      def initialize(options = {})
        init_actable(options)
      end

      def post_init
        enqueue(:post_init, nil)
      end

      def receive_data(data)
        enqueue(:receive_data, data)
      end

      def unbind
        enqueue(:unbind, nil)
      end
    end
  end
end
<commit_msg>Add default handlers for EM connection events.<commit_after>module Tribe
  module EM
    class Connection < ::EM::Connection
      include Tribe::Actable

      def initialize(options = {})
        init_actable(options)
      end

      def post_init
        enqueue(:post_init, nil)
      end

      def receive_data(data)
        enqueue(:receive_data, data)
      end

      def unbind
        enqueue(:unbind, nil)
      end

      def process_event(event)
        case event.command
        when :post_init
          post_init_handler(event)
        when :receive_data
          receive_data_handler(event)
        when :unbind
          unbind_handler(event)
        end
      end

      def post_init_handler(event)
        puts "Actor (#{identifier}) connected to client using thread (#{Thread.current.object_id})."
      end

      def receive_data_handler(event)
        puts "Actor (#{identifier}) received data (#{event.data}) using thread (#{Thread.current.object_id})."
      end

      def unbind_handler(event)
        puts "Actor (#{identifier}) disconnected from client using thread (#{Thread.current.object_id})."
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.0838095238095238, 'fraction_numerical': 0.0, 'mean_word_length': 2.2295081967213113, 'pattern_counts': {'":': 0, '<': 5, '<?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': '90205', 'n_tokens_mistral': 459, 'n_tokens_neox': 442, 'n_words': 119}