<commit_before>module ProgressBar
  module Components
    module Progressable
      DEFAULT_TOTAL              = 100
      DEFAULT_BEGINNING_POSITION = 0

      attr_reader               :total
      attr_reader               :progress
      attr_accessor             :starting_position

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

        start :at => DEFAULT_BEGINNING_POSITION
      end

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

      def started?
        !!self.starting_position
      end

      def increment
        self.progress += 1 unless progress == total
      end

      def decrement
        self.progress -= 1 unless progress == 0
      end

      def reset
        start :at => self.starting_position
      end

      def progress=(new_progress)
        validate_progress(new_progress)
        @progress = new_progress
      end

      def total=(new_total)
        validate_total(new_total)
        @total = new_total
      end

      def finish
        self.progress = self.total
      end

      def percentage_completed
        # progress / total * 100
        #
        # Doing this way so we can avoid converting each
        # number to a float and then back to an integer.<commit_msg>Whitespace<commit_after>module ProgressBar
  module Components
    module Progressable
      DEFAULT_TOTAL              = 100
      DEFAULT_BEGINNING_POSITION = 0

      attr_reader               :total
      attr_reader               :progress
      attr_accessor             :starting_position

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

        start :at => DEFAULT_BEGINNING_POSITION
      end

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

      def started?
        !!self.starting_position
      end

      def increment
        self.progress += 1 unless progress == total
      end

      def decrement
        self.progress -= 1 unless progress == 0
      end

      def reset
        start :at => self.starting_position
      end

      def progress=(new_progress)
        validate_progress(new_progress)

        @progress = new_progress
      end

      def total=(new_total)
        validate_total(new_total)
        @total = new_total
      end

      def finish
        self.progress = self.total
      end

      def percentage_completed
        # progress / total * 100
        #
        # Doing this way so we can avoid converting each
        # number to a float and then back to an integer.
{'fraction_non_alphanumeric': 0.059580728208900334, 'fraction_numerical': 0.00735564545788893, 'mean_word_length': 1.6745329400196658, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '28', 'n_tokens_mistral': 736, 'n_tokens_neox': 676, 'n_words': 197}