<commit_before>require 'source_map/offset'

module SourceMap
  class Mapping
    include Comparable

    def initialize(source, generated, original, name = nil)
      @source, @generated, @original = source, generated, original
      @name = name
    end

    attr_reader :generated, :original, :source, :name

    def <=>(other)
      case other
      when Mapping
        self.generated <=> other.generated
      when Offset
        self.generated <=> other
      else
        raise ArgumentError, "can't convert #{other.class} into #{self.class}"
      end
    end

    def inspect
      "#<#{self.class} generated=#{generated}, original=#{original}, source=#{source}, name=#{name}>"<commit_msg>Ensure mapping source and generated offsets are wrapped<commit_after>require 'source_map/offset'

module SourceMap
  class Mapping
    include Comparable

    def initialize(source, generated, original, name = nil)
      @source, @generated, @original = source, Offset.new(generated), Offset.new(original)
      @name = name
    end

    attr_reader :generated, :original, :source, :name

    def <=>(other)
      case other
      when Mapping
        self.generated <=> other.generated
      when Offset
        self.generated <=> other
      else
        raise ArgumentError, "can't convert #{other.class} into #{self.class}"
      end
    end

    def inspect
      "#<#{self.class} generated=#{generated}, original=#{original}, source=#{source}, name=#{name}>"
{'fraction_non_alphanumeric': 0.11764705882352941, 'fraction_numerical': 0.0, 'mean_word_length': 3.063888888888889, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '891042', 'n_tokens_mistral': 411, 'n_tokens_neox': 400, 'n_words': 120}