<commit_before>#- Copyright 2008 8th Light, Inc. All Rights Reserved.
#- Limelight and all included source files are distributed under terms of the GNU LGPL.

require 'limelight/builtin/players'

module Limelight

  # The CastingDirector is responsible for finding Players for Props within a Production.
  # Each Producer has an instance of a CastingDirector
  #
  # Users of Limelight need not be concerned with this class.
  #
  class CastingDirector

    def initialize(loader)
      @loader = loader
      @known_players = {}
    end

    def fill_cast(prop)
      raise LimelightException.new("Cannot cast a Prop without a Scene.") if prop.scene.nil?
      cast_default_player(prop)
      cast_additional_players(prop)
    end

    private ###############################################

    def cast_default_player(prop)
      return if prop.name.nil? || prop.name.empty?
      cast_player(prop, prop.name)
    end

    def cast_additional_players(prop)
      return if prop.players.nil? || prop.players.empty?
      player_names = prop.players.split(/[ ,]/)
      player_names.each do |player_name|
        cast_player(prop, player_name)
      end
    end

    def cast_player(prop, player_name)      
      recruiter = Recruiter.new(prop, player_name, @loader)
      puts "Player #{player_name} exists? = #{recruiter.player_exists?}"
      prop.include_player(recruiter.player) if recruiter.player_exists?
    end
  end

  class Recruiter<commit_msg>removing puts<commit_after>#- Copyright 2008 8th Light, Inc. All Rights Reserved.
#- Limelight and all included source files are distributed under terms of the GNU LGPL.

require 'limelight/builtin/players'

module Limelight

  # The CastingDirector is responsible for finding Players for Props within a Production.
  # Each Producer has an instance of a CastingDirector
  #
  # Users of Limelight need not be concerned with this class.
  #
  class CastingDirector

    def initialize(loader)
      @loader = loader
      @known_players = {}
    end

    def fill_cast(prop)
      raise LimelightException.new("Cannot cast a Prop without a Scene.") if prop.scene.nil?
      cast_default_player(prop)
      cast_additional_players(prop)
    end

    private ###############################################

    def cast_default_player(prop)
      return if prop.name.nil? || prop.name.empty?
      cast_player(prop, prop.name)
    end

    def cast_additional_players(prop)
      return if prop.players.nil? || prop.players.empty?
      player_names = prop.players.split(/[ ,]/)
      player_names.each do |player_name|
        cast_player(prop, player_name)
      end
    end

    def cast_player(prop, player_name)      
      recruiter = Recruiter.new(prop, player_name, @loader)
      prop.include_player(recruiter.player) if recruiter.player_exists?
    end
  end

  class Recruiter
{'fraction_non_alphanumeric': 0.10826010544815466, 'fraction_numerical': 0.0035149384885764497, 'mean_word_length': 3.266866566716642, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1190588', 'n_tokens_mistral': 872, 'n_tokens_neox': 838, 'n_words': 243}