This file is indexed.

/usr/lib/ruby/vendor_ruby/sequel/plugins/update_primary_key.rb is in ruby-sequel 3.36.1-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
47
48
module Sequel
  module Plugins
    # The update_primary_key plugin allows you to modify an object's
    # primary key and then save the record.  Sequel does not work
    # correctly with primary key modifications by default.  Sequel
    # is designed to work with surrogate primary keys that never need to be
    # modified, but this plugin makes it work correctly with natural
    # primary keys that may need to be modified. Example:
    #
    #   album = Album[1]
    #   album.id = 2
    #   album.save
    # 
    # Usage:
    #
    #   # Make all model subclasses support primary key updates
    #   # (called before loading subclasses)
    #   Sequel::Model.plugin :update_primary_key
    #
    #   # Make the Album class support primary key updates
    #   Album.plugin :update_primary_key
    module UpdatePrimaryKey
      module ClassMethods
        # Cache the pk_hash when loading records
        def call(h)
          r = super(h)
          r.pk_hash
          r
        end
      end

      module InstanceMethods
        # Clear the pk_hash and object dataset cache, and recache
        # the pk_hash
        def after_update
          super
          @pk_hash = nil
          pk_hash
        end

        # Cache the pk_hash instead of generating it every time
        def pk_hash
          @pk_hash ||= super
        end
      end
    end
  end
end