<commit_before>module VCR
  class LibraryVersionTooLowError < StandardError; end

  class VersionChecker
    def initialize(library_name, library_version, min_patch_level, max_minor_version)
      @library_name, @library_version = library_name, library_version
      @min_patch_level, @max_minor_version = min_patch_level, max_minor_version

      @major,     @minor,     @patch     = parse_version(library_version)
      @min_major, @min_minor, @min_patch = parse_version(min_patch_level)
      @max_major, @max_minor             = parse_version(max_minor_version)

      @comparison_result = compare_version
    end

    def check_version!
      raise_too_low_error if too_low?
      warn_about_too_high if too_high?
    end

  private

    attr_reader :library_name, :library_version, :min_patch_level, :max_minor_version, :comparison_result,
                :major, :minor, :patch, :min_major, :min_minor, :min_patch, :max_major, :max_minor

    def too_low?
      comparison_result == :too_low
    end

    def too_high?
      comparison_result == :too_high
    end

    def raise_too_low_error
      raise LibraryVersionTooLowError, "You are using #{library_name} #{library_version}. " +
                                       "VCR requires version #{version_requirement}."
    end

    def warn_about_too_high
      Kernel.warn "You are using #{library_name} #{library_version}. " +
                  "VCR is known to work with #{library_name} #{version_requirement}. " +
                  "It may not work with this version."
    end

    def compare_version
      case
        when major < min_major then :too_low
        when major > max_major then :too_high
        when minor < min_minor then :too_low
        when minor > max_minor then :too_high
        when patch < min_patch then :too_low
      end
    end

    def version_requirement
      max_major, max_minor = parse_version(max_minor_version)
      ">= #{min_patch_level}, < #{max_major}.#{max_minor + 1}"
    end

    def parse_version(version)
      version.split('.').map { |v| v.to_i }
    end
  end
end

<commit_msg>Fix ruby warnings (private attributes).<commit_after>module VCR
  class LibraryVersionTooLowError < StandardError; end

  class VersionChecker
    def initialize(library_name, library_version, min_patch_level, max_minor_version)
      @library_name, @library_version = library_name, library_version
      @min_patch_level, @max_minor_version = min_patch_level, max_minor_version

      @major,     @minor,     @patch     = parse_version(library_version)
      @min_major, @min_minor, @min_patch = parse_version(min_patch_level)
      @max_major, @max_minor             = parse_version(max_minor_version)

      @comparison_result = compare_version
    end

    def check_version!
      raise_too_low_error if too_low?
      warn_about_too_high if too_high?
    end

  private

    def too_low?
      @comparison_result == :too_low
    end

    def too_high?
      @comparison_result == :too_high
    end

    def raise_too_low_error
      raise LibraryVersionTooLowError, "You are using #{@library_name} #{@library_version}. " +
                                       "VCR requires version #{@version_requirement}."
    end

    def warn_about_too_high
      Kernel.warn "You are using #{@library_name} #{@library_version}. " +
                  "VCR is known to work with #{@library_name} #{@version_requirement}. " +
                  "It may not work with this version."
    end

    def compare_version
      case
        when @major < @min_major then :too_low
        when @major > @max_major then :too_high
        when @minor < @min_minor then :too_low
        when @minor > @max_minor then :too_high
        when @patch < @min_patch then :too_low
      end
    end

    def version_requirement
      ">= #{@min_patch_level}, < #{@max_major}.#{@max_minor + 1}"
    end

    def parse_version(version)
      version.split('.').map { |v| v.to_i }
    end
  end
end


{'fraction_non_alphanumeric': 0.08276558163007823, 'fraction_numerical': 0.0005046681806712087, 'mean_word_length': 2.764482431149098, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7035292', 'n_tokens_mistral': 1266, 'n_tokens_neox': 1198, 'n_words': 295}