<commit_before>class IOActors::ControllerActor < Concurrent::Actor::RestartingContext

  def initialize io
    @io = io
    listener = if parent != Concurrent::Actor.root
                 parent
               end
    @reader = IOActors::ReaderActor.spawn("reader", io, listener)
    @writer = IOActors::WriterActor.spawn("writer", io)
    @selector = nil
  end

  def on_message message
    case message
    when IOActors::SelectMessage
      select message.actor
    when IOActors::InformMessage
      @reader << message
    when :read
      @reader << message
    when IOActors::OutputMessage, String
      @writer << message<commit_msg>Use #redirect method for message passthrough<commit_after>class IOActors::ControllerActor < Concurrent::Actor::RestartingContext

  def initialize io
    @io = io
    listener = if parent != Concurrent::Actor.root
                 parent
               end
    @reader = IOActors::ReaderActor.spawn("reader", io, listener)
    @writer = IOActors::WriterActor.spawn("writer", io)
    @selector = nil
  end

  def on_message message
    case message
    when IOActors::SelectMessage
      select message.actor
    when IOActors::InformMessage, :read
      redirect @reader
    when IOActors::OutputMessage, String
      redirect @writer
{'fraction_non_alphanumeric': 0.08869701726844584, 'fraction_numerical': 0.0, 'mean_word_length': 3.0348101265822787, 'pattern_counts': {'":': 0, '<': 11, '<?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': '4990719', 'n_tokens_mistral': 352, 'n_tokens_neox': 347, 'n_words': 93}