<commit_before>require 'ruby-progressbar/errors/invalid_progress_error'

class   ProgressBar
class   Progress
  DEFAULT_TOTAL              = 100
  DEFAULT_BEGINNING_POSITION = 0
  DEFAULT_SMOOTHING          = 0.1

  attr_accessor             :total,
                            :progress,
                            :starting_position,
                            :running_average,
                            :smoothing

  def initialize(options = {})
    self.total     = options.fetch(:total, DEFAULT_TOTAL)
    self.smoothing = options[:smoothing] || DEFAULT_SMOOTHING

    start :at => DEFAULT_BEGINNING_POSITION
  end

  def start(options = {})
    self.running_average   = 0
    self.progress          = \
    self.starting_position = options[:at] || progress
  end

  def finish
    self.progress = total
  end

  def finished?
    progress == total
  end

  def increment
    warn "WARNING: Your progress bar is currently at #{progress} out of #{total} " \
         'and cannot be incremented. In v2.0.0 this will become a ' \
         'ProgressBar::InvalidProgressError.' if progress == total

    self.progress += 1 unless progress == total<commit_msg>Refactor: Change 'Progress#finished?' to use instance variables<commit_after>require 'ruby-progressbar/errors/invalid_progress_error'

class   ProgressBar
class   Progress
  DEFAULT_TOTAL              = 100
  DEFAULT_BEGINNING_POSITION = 0
  DEFAULT_SMOOTHING          = 0.1

  attr_accessor             :total,
                            :progress,
                            :starting_position,
                            :running_average,
                            :smoothing

  def initialize(options = {})
    self.total     = options.fetch(:total, DEFAULT_TOTAL)
    self.smoothing = options[:smoothing] || DEFAULT_SMOOTHING

    start :at => DEFAULT_BEGINNING_POSITION
  end

  def start(options = {})
    self.running_average   = 0
    self.progress          = \
    self.starting_position = options[:at] || progress
  end

  def finish
    self.progress = total
  end

  def finished?
    @progress == @total
  end

  def increment
    warn "WARNING: Your progress bar is currently at #{progress} out of #{total} " \
         'and cannot be incremented. In v2.0.0 this will become a ' \
         'ProgressBar::InvalidProgressError.' if progress == total

    self.progress += 1 unless progress == total
{'fraction_non_alphanumeric': 0.08109243697478992, 'fraction_numerical': 0.009243697478991597, 'mean_word_length': 2.0802069857697285, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3081655', 'n_tokens_mistral': 689, 'n_tokens_neox': 638, 'n_words': 171}