Module: Sequel::Privacy::TransientViewerContext
- Extended by:
- T::Helpers, T::Sig
- Included in:
- AllPowerfulVC, OmniscientVC
- Defined in:
- lib/sequel/privacy/viewer_context.rb
Overview
Made available on OmniscientVC and AllPowerfulVCs. Transient contexts are invalidated when the use block exists. To help you keep these around for as short a time as possible.
Instance Method Summary collapse
Instance Method Details
#invalidate! ⇒ Object
85 86 87 88 89 90 91 |
# File 'lib/sequel/privacy/viewer_context.rb', line 85 def invalidate! unless invalidated? Sequel::Privacy.logger&.debug("Invalidating viewer context: #{reason}") @invalidated = T.let(true, T.nilable(T::Boolean)) end self end |
#reason ⇒ Object
71 |
# File 'lib/sequel/privacy/viewer_context.rb', line 71 def reason; end |
#use(&block) ⇒ Object
78 79 80 81 82 |
# File 'lib/sequel/privacy/viewer_context.rb', line 78 def use(&block) block.call(self, reason) ensure invalidate! end |