<commit_before>module NBA
  class Player
    attr_reader :name, :number, :position, :from, :to

    def initialize(attributes = {})
      attributes.each do |key, value|
        instance_variable_set("@#{key}", value) if self.respond_to?(key)
      end
    end

    # Returns an array of Player objects given a team roster
    def self.all_from_roster(players)
      players.map do |player|
        next if player['to'] != nil

        new(
          :name     => player['player'],
          :number   => player['number'],
          :position => player['position'],
          :from     => player['from'],
          :to       => "Present"
        )
      end.compact
    end
  end
end<commit_msg>Make code read clearer. [ci skip]<commit_after>module NBA
  class Player
    attr_reader :name, :number, :position, :from, :to

    def initialize(attributes = {})
      attributes.each do |key, value|
        instance_variable_set("@#{key}", value) if self.respond_to?(key)
      end
    end

    # Returns an array of Player objects given a team roster
    def self.all_from_roster(players)
      players.select{ |player| player['to'].nil? }.map do |player|
        new(
          :name     => player['player'],
          :number   => player['number'],
          :position => player['position'],
          :from     => player['from'],
          :to       => "Present"
        )
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.1291012838801712, 'fraction_numerical': 0.0, 'mean_word_length': 2.1670428893905194, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '303115', 'n_tokens_mistral': 410, 'n_tokens_neox': 408, 'n_words': 115}