This file is indexed.

/usr/lib/ruby/vendor_ruby/rspec/matchers/built_in/be_between.rb is in ruby-rspec-expectations 3.4.0c3e0m1s1-1ubuntu1.

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
module RSpec
  module Matchers
    module BuiltIn
      # @api private
      # Provides the implementation for `be_between`.
      # Not intended to be instantiated directly.
      class BeBetween < BaseMatcher
        def initialize(min, max)
          @min, @max = min, max
          inclusive
        end

        # @api public
        # Makes the between comparison inclusive.
        #
        # @example
        #   expect(3).to be_between(2, 3).inclusive
        #
        # @note The matcher is inclusive by default; this simply provides
        #       a way to be more explicit about it.
        def inclusive
          @less_than_operator = :<=
          @greater_than_operator = :>=
          @mode = :inclusive
          self
        end

        # @api public
        # Makes the between comparison exclusive.
        #
        # @example
        #   expect(3).to be_between(2, 4).exclusive
        def exclusive
          @less_than_operator = :<
          @greater_than_operator = :>
          @mode = :exclusive
          self
        end

        # @api private
        # @return [Boolean]
        def matches?(actual)
          @actual = actual
          comparable? && compare
        rescue ArgumentError
          false
        end

        # @api private
        # @return [String]
        def failure_message
          "#{super}#{not_comparable_clause}"
        end

        # @api private
        # @return [String]
        def description
          "be between #{description_of @min} and #{description_of @max} (#{@mode})"
        end

      private

        def comparable?
          @actual.respond_to?(@less_than_operator) && @actual.respond_to?(@greater_than_operator)
        end

        def not_comparable_clause
          ", but it does not respond to `#{@less_than_operator}` and `#{@greater_than_operator}`" unless comparable?
        end

        def compare
          @actual.__send__(@greater_than_operator, @min) && @actual.__send__(@less_than_operator, @max)
        end
      end
    end
  end
end