This file is indexed.

/usr/lib/ruby/vendor_ruby/rspec/support/comparable_version.rb is in ruby-rspec-support 3.5.0c3e0m0s0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
module RSpec
  module Support
    # @private
    class ComparableVersion
      include Comparable

      attr_reader :string

      def initialize(string)
        @string = string
      end

      def <=>(other)
        other = self.class.new(other) unless other.is_a?(self.class)

        return 0 if string == other.string

        longer_segment_count = [self, other].map { |version| version.segments.count }.max

        longer_segment_count.times do |index|
          self_segment = segments[index] || 0
          other_segment = other.segments[index] || 0

          if self_segment.class == other_segment.class
            result = self_segment <=> other_segment
            return result unless result == 0
          else
            return self_segment.is_a?(String) ? -1 : 1
          end
        end

        0
      end

      def segments
        @segments ||= string.scan(/[a-z]+|\d+/i).map do |segment|
          if segment =~ /\A\d+\z/
            segment.to_i
          else
            segment
          end
        end
      end
    end
  end
end