module Sequel::Plugins::AccessedColumns::InstanceMethods

  1. lib/sequel/plugins/accessed_columns.rb

Methods

Public Instance

  1. []
  2. accessed_columns
  3. after_save
  4. initialize_copy

Public Instance methods

[](c)

Record the column access before retrieving the value.

[show source]
   # File lib/sequel/plugins/accessed_columns.rb
31 def [](c)
32   (@accessed_columns ||= {})[c] = true unless frozen?
33   super
34 end
accessed_columns()

The columns that have been accessed.

[show source]
   # File lib/sequel/plugins/accessed_columns.rb
43 def accessed_columns
44   @accessed_columns ? @accessed_columns.keys : []
45 end
after_save()

Clear the accessed columns when saving.

[show source]
   # File lib/sequel/plugins/accessed_columns.rb
37 def after_save
38   super
39   @accessed_columns = nil
40 end
initialize_copy(other)

Copy the accessed columns when duping and cloning.

[show source]
   # File lib/sequel/plugins/accessed_columns.rb
48 def initialize_copy(other)
49   other.instance_variable_set(:@accessed_columns, Hash[@accessed_columns]) if @accessed_columns
50   super
51 end