<commit_before>class SecretSanta::Dsl
  class << self

    def generate(&block)
      @exchange = SecretSanta::Exchange.new
      instance_eval(&block)
      @exchange
    end

    def title(title_string)
      @exchange.title = title_string
      nil
    end

    def add_person(name, opts={})
      @exchange << SecretSanta::Person.new(opts.merge(name: name))
      nil
    end

    def person(person_id)
      if person_id.is_a?(SecretSanta::Person)
        SecretSanta::Dsl::Person.new(person_id, @exchange)
      else
        SecretSanta::Dsl::Person.new(@exchange.find_person!(person_id), @exchange)
      end
    end

  end

  class Person
    attr_reader :person

    def initialize(person, exchange)
      @person = person
      @exchange = exchange
    end

    def will_not_give_to(exception)
      person.add_exception(@exchange.find_person!(exception))
    end

    def will_not_receive_from(exception)
      @exchange.find_person!(exception).add_exception(person)
    end

    def will_not_exchange_with(exception)
      person.add_exception(@exchange.find_person!(exception))
      @exchange.find_person!(exception).add_exception(person)
    end
  end
end<commit_msg>Slightly more efficient<commit_after>class SecretSanta::Dsl
  class << self

    def generate(&block)
      @exchange = SecretSanta::Exchange.new
      instance_eval(&block)
      @exchange
    end

    def title(title_string)
      @exchange.title = title_string
      nil
    end

    def add_person(name, opts={})
      @exchange << SecretSanta::Person.new(opts.merge(name: name))
      nil
    end

    def person(person_id)
      if person_id.is_a?(SecretSanta::Person)
        SecretSanta::Dsl::Person.new(person_id, @exchange)
      else
        SecretSanta::Dsl::Person.new(@exchange.find_person!(person_id), @exchange)
      end
    end

  end

  class Person
    attr_reader :person

    def initialize(person, exchange)
      @person = person
      @exchange = exchange
    end

    def will_not_give_to(exception)
      person.add_exception(@exchange.find_person!(exception))
    end

    def will_not_receive_from(exception)
      @exchange.find_person!(exception).add_exception(person)
    end

    def will_not_exchange_with(exception)
      exception_person = @exchange.find_person!(exception)

      person.add_exception(exception_person)
      exception_person.add_exception(person)
    end
  end
end
{'fraction_non_alphanumeric': 0.0975, 'fraction_numerical': 0.0, 'mean_word_length': 3.1539792387543253, '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': '3359127', 'n_tokens_mistral': 775, 'n_tokens_neox': 711, 'n_words': 131}