This file is indexed.

/usr/share/doc/ruby-dirty-memoize/examples/only_reader.rb is in ruby-dirty-memoize 0.0.4-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
$:.unshift(File.expand_path(File.dirname(__FILE__)+"/../lib"))
# This example shows the use of dirty_memoize without dirty_writer.
# When we call the method marked with dirty_memoize on a dirty object
# compute method is called. 

require 'dirty-memoize'

class Factorial
  include DirtyMemoize
  attr_reader :result
  dirty_memoize :result
  def initialize(n)
    @n=n
    @result=nil
  end
  def fact(n)
    return 1 if n==1
    n*(fact(n-1))
  end
  def compute
    puts "Computing the factorial!"
    @result=fact(@n)
  end
end

a=Factorial.new(10)
puts "Our object is dirty: #{a.dirty?}"
puts "The result is: #{a.result}"
puts "Our object is no longer dirty: #{a.dirty?}"
puts "And the result is cached without calling the compute method: #{a.result}"
a.clean_cache
# Object is now dirty. So, compute will be called when we get result
puts "The result is: #{a.result}"