class Protector::Adapters::Sequel::Dataset::Restrictor
Wrapper for the Dataset
‘row_proc` adding restriction function
Attributes
mutator[RW]
subject[RW]
Public Class Methods
new(subject, mutator)
click to toggle source
# File lib/protector/adapters/sequel/dataset.rb, line 12 def initialize(subject, mutator) @subject = subject @mutator = mutator end
Public Instance Methods
call(entity)
click to toggle source
Mutate entity through ‘row_proc` if available and then protect
@param entity [Object] Entity coming from Dataset
# File lib/protector/adapters/sequel/dataset.rb, line 20 def call(entity) entity = mutator.call(entity) if mutator return entity unless entity.respond_to?(:restrict!) entity.restrict!(@subject) end