<commit_before>require 'hoptoad/v2'

module Hoptoad
  class ApiVersionError < StandardError
    def initialize
      super "Wrong API Version: Expecting 2.0, 2.1, 2.2, 2.3 or 2.4"
    end
  end

  def self.parse_xml!(xml)
    parsed = ActiveSupport::XmlMini.backend.parse(xml)['notice'] || raise(ApiVersionError)
    processor = get_version_processor(parsed['version'])
    processor.process_notice(parsed)
  end

  private def self.get_version_processor(version)
    case version
    when /2\.[01234]/ then Hoptoad::V2
    else; raise ApiVersionError
    end
  end
end
<commit_msg>Rubocop: when using access-modifier on method definition line, must be an instance method<commit_after>require 'hoptoad/v2'

module Hoptoad
  class ApiVersionError < StandardError
    def initialize
      super "Wrong API Version: Expecting 2.0, 2.1, 2.2, 2.3 or 2.4"
    end
  end

  class << self
    def parse_xml!(xml)
      parsed = ActiveSupport::XmlMini.backend.parse(xml)['notice'] || raise(ApiVersionError)
      processor = get_version_processor(parsed['version'])
      processor.process_notice(parsed)
    end

    private def get_version_processor(version)
      case version
      when /2\.[01234]/ then Hoptoad::V2
      else; raise ApiVersionError
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.09497645211930926, 'fraction_numerical': 0.0282574568288854, 'mean_word_length': 3.458041958041958, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '2828194', 'n_tokens_mistral': 425, 'n_tokens_neox': 413, 'n_words': 107}