<commit_before>require "shopping_cart/version"

module ShoppingCart
  class Cart
    def initialize(items, shopping_day = Date.today, extra_loyal_customer = false)
      @items = items
      @shopping_day = shopping_day
      @extra_loyal_customer = extra_loyal_customer
    end

    def total
      items_total - loyalty_discount
    end

    private
    def loyalty_discount
      return 0 unless @extra_loyal_customer

      items_total * 0.1
    end

    def items_total
      @items_total ||= @items.inject(0) do |total, item|
        total += (item.price - item.discount(@shopping_day))
      end
    end
  end

  class Item
    attr_reader :name, :price

    def initialize(name, price)
      @name = name
      @price = price
    end

    def discount(shopping_day)
      if [6,0].include?(shopping_day.wday) && @name == 'Banana'
        return @price * 0.1
      elsif @name == 'Vacuum cleaner' && @price > 100
        return @price * 0.05
      end

      0
    end
  end
end<commit_msg>Blank slate<commit_after>require "shopping_cart/version"

module ShoppingCart
  class Cart
    def initialize(items, shopping_day = Date.today, extra_loyal_customer = false)
      @items = items
      @shopping_day = shopping_day
      @extra_loyal_customer = extra_loyal_customer
    end

    def total
    end

  end

  class Item
    attr_reader :name, :price

    def initialize(name, price)
      @name = name
      @price = price
    end

    def discount(shopping_day)
    end
  end
end
{'fraction_non_alphanumeric': 0.07852348993288591, 'fraction_numerical': 0.010067114093959731, 'mean_word_length': 2.508235294117647, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '1637991', 'n_tokens_mistral': 499, 'n_tokens_neox': 481, 'n_words': 124}