This file is indexed.

/usr/lib/ruby/vendor_ruby/insist/predicates.rb is in ruby-insist 1.0.0-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
require "insist/namespace"
require "insist/assert"

module Insist::Predicates
  include Insist::Assert
  PREDICATE_METHOD_RE = /\?$/

  # Fails if the value does not respond to a method.
  # 
  # insist { "hurray" }.respond_to?(:size)
  def respond_to?(method)
    assert(value.respond_to?(method),
           "#{value.class} does not respond to the '#{method}' method")
  end # def respond_to?

  # Fails if the value.is_a?(klass) returns false.
  # 
  # insist { "hurray" }.is_a?(Number)
  def is_a?(klass)
    assert(value.is_a?(klass), "#{value.class} is not a #{klass}")
  end

  # Pass through any 'foo?' style method calls to the 'value' 
  # and fail if the the return is false.
  def method_missing(m, *args)
    # If this is a predicate method (ends in question mark)
    # call it on the value and assert truthiness.
    if PREDICATE_METHOD_RE.match(m.to_s)
      insist { value }.respond_to?(m)

      # call the method, like .empty?, result must be truthy.
      result = value.send(m, *args)
      assert(result, 
             "#{value.class}{#{value.inspect}}##{m}(#{args.join(",")}) " \
             "expected to return a truthy value, but returned #{result}")
      return result
    else
      return super(m, *args)
    end
  end # def method_missing
end # module Insist::Predicates