<commit_before>require_relative 'api_fetcher'
require 'json'

class DataFilter

  attr_reader :api_fetch, :data

  def initialize(data)
    @data = JSON.parse(data)
  end

  def count
    data['count']
  end

  def average_price
    @data['results']
    i = 0
    sum = 0
    while i < @data['results'].count
      sum += @data['results'][i]['price'].to_f
      i += 1
      puts "this item costs £#{sum}. The total is £#{sum}"
      puts "average is now £#{(sum / @data['results'].count).round(2)}"
    end
    p (sum / @data['results'].count).round(2)
  end

  def lowest_price

  end<commit_msg>added min max price method<commit_after>require_relative 'api_fetcher'
require 'json'

class DataFilter

  attr_reader :api_fetch, :data

  def initialize(data)
    @data = JSON.parse(data)
  end

  def count
    data['count']
  end

  def average_price
    @data['results']
    i = 0
    sum = 0
    while i < @data['results'].count
      sum += @data['results'][i]['price'].to_f
      i += 1
      puts "this item costs £#{sum}. The total is £#{sum}"
      puts "average is now £#{(sum / @data['results'].count).round(2)}"
    end
    p (sum / @data['results'].count).round(2)
  end

  def min_max_price
    data['results'].minmax {|a,b|a['price'] <=> b['price']}
  end
{'fraction_non_alphanumeric': 0.16154452324665092, 'fraction_numerical': 0.007880220646178092, 'mean_word_length': 2.981191222570533, 'pattern_counts': {'":': 0, '<': 6, '<?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': '612033', 'n_tokens_mistral': 455, 'n_tokens_neox': 445, 'n_words': 116}