This file is indexed.

/usr/lib/ruby/1.8/ramaze/reloader/watch_stat.rb is in libramaze-ruby1.8 2010.06.18-2.

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
module Ramaze
  class Reloader
    class WatchStat
      def initialize
        # @files[file_path] = stat
        @files = {}
        @last = Time.now
      end

      def call(cooldown)
        if cooldown and Time.now > @last + cooldown
          yield
          @last = Time.now
        end
      end

      # start watching a file for changes
      # true if succeeded, false if failure
      def watch(file)
        return true if watching?(file) # if already watching
        if stat = safe_stat(file)
          @files[file] = stat
        end
      end

      def watching?(file)
        @files.has_key?(file)
      end

      # stop watching a file for changes
      def remove_watch(file)
        @files.delete(file)
      end

      # no need for cleanup
      def close
      end

      # return files changed since last call
      def changed_files
        @files.each do |file, stat|
          if new_stat = safe_stat(file)
            if new_stat.mtime > stat.mtime
              @files[file] = new_stat
              yield(file)
            end
          end
        end
      end

      def safe_stat(file)
        File.stat(file)
      rescue Errno::ENOENT, Errno::ENOTDIR
        nil
      end
    end
  end
end