<commit_before>class Card

  attr_reader :value, :suit# this is like attr_accessor, but read-only
                    # meaning we can't do something like card.suit = :spades
                    # to *change* a card's suit
  def initialize(value, suit)
    @value = value
    @suit = suit
  end
end

class Deck

  #attr_reader :cards don't need this anymore with methods using @cards

  def initialize
    @cards = []
    [ :hearts, :diamonds, :clubs, :spades ].each do |suit|
      ((2..10).to_a + [ :jack, :queen, :king, :ace ]).each do |value|
        @cards << Card.new(value, suit)
      end
    end
  end

  def length
    @cards.length
  end

  def [](index)
    @cards[index]
  end
end<commit_msg>refactor Deck initialization to be more Ruby-ish<commit_after>class Card

  attr_reader :value, :suit# this is like attr_accessor, but read-only
                    # meaning we can't do something like card.suit = :spades
                    # to *change* a card's suit
  def initialize(value, suit)
    @value = value
    @suit = suit
  end
end

class Deck

  #attr_reader :cards don't need this anymore with methods using @cards

  def initialize
    @cards = [ :hearts, :diamonds, :clubs, :spades ].map do |suit|
      ((2..10).to_a + [ :jack, :queen, :king, :ace ]).map do |value|
        Card.new(value, suit)
      end
    end.flatten
  end

  def length
    @cards.length
  end

  def [](index)
    @cards[index]
  end
end
{'fraction_non_alphanumeric': 0.1108786610878661, 'fraction_numerical': 0.0041841004184100415, 'mean_word_length': 2.384433962264151, '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': '4074041', 'n_tokens_mistral': 492, 'n_tokens_neox': 467, 'n_words': 160}