module Sequel::Plugins::InstanceFilters::InstanceMethods

  1. lib/sequel/plugins/instance_filters.rb

Public Instance methods

after_destroy()

Clear the instance filters after successfully destroying the object.

[show source]
   # File lib/sequel/plugins/instance_filters.rb
59 def after_destroy
60   super
61   clear_instance_filters
62 end
after_update()

Clear the instance filters after successfully updating the object.

[show source]
   # File lib/sequel/plugins/instance_filters.rb
65 def after_update
66   super
67   clear_instance_filters
68 end
freeze()

Freeze the instance filters when freezing the object

[show source]
   # File lib/sequel/plugins/instance_filters.rb
71 def freeze
72   instance_filters.freeze
73   super
74 end
instance_filter(*args, &block)

Add an instance filter to the array of instance filters Both the arguments given and the block are passed to the dataset’s filter method.

[show source]
   # File lib/sequel/plugins/instance_filters.rb
79 def instance_filter(*args, &block)
80   instance_filters << [args, block]
81 end
save_changes(opts=OPTS)

Clear instance filters when saving changes even if the object wasn’t modified.

[show source]
   # File lib/sequel/plugins/instance_filters.rb
85 def save_changes(opts=OPTS)
86   ret = super
87   clear_instance_filters if ret.nil?
88   ret
89 end