<commit_before>class SlotDetailsParser
  def initialize(raw)
    @raw = raw
  end

  def recurring_slots
    @raw.fetch('recurring', {}).map { |day, slots|
      [DayOfWeek.by_name(day), slots.map { |s| RecurringSlot.parse(s) }]
    }.to_h
  end

  def anomalous_slots
    @raw.fetch('anomalous', {}).map { |date, slots|
      [Date.parse(date), slots.map { |s| RecurringSlot.parse(s) }]
    }.to_h
  end

  def unbookable_dates
    @raw.fetch('unbookable', {}).map { |date| Date.parse(date) }
  end
end<commit_msg>Parse slot details eagerly<commit_after>class SlotDetailsParser
  def initialize(raw)
    @recurring_slots = parse_recurring_slots(raw)
    @anomalous_slots = parse_anomalous_slots(raw)
    @unbookable_dates = parse_unbookable_dates(raw)
  end

  attr_reader :recurring_slots, :anomalous_slots, :unbookable_dates

private

  def parse_recurring_slots(raw)
    raw.fetch('recurring', {}).map { |day, slots|
      [DayOfWeek.by_name(day), slots.map { |s| RecurringSlot.parse(s) }]
    }.to_h
  end

  def parse_anomalous_slots(raw)
    raw.fetch('anomalous', {}).map { |date, slots|
      [Date.parse(date), slots.map { |s| RecurringSlot.parse(s) }]
    }.to_h
  end

  def parse_unbookable_dates(raw)
    raw.fetch('unbookable', {}).map { |date| Date.parse(date) }
  end
end
{'fraction_non_alphanumeric': 0.14440993788819875, 'fraction_numerical': 0.0, 'mean_word_length': 3.9386973180076628, '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': '4919985', 'n_tokens_mistral': 513, 'n_tokens_neox': 498, 'n_words': 89}