Class: Hubbado::Policy::Scope

Inherits:
Object
  • Object
show all
Defined in:
lib/hubbado/policy/scope.rb

Defined Under Namespace

Modules: Substitute

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.buildObject



13
14
15
16
17
# File 'lib/hubbado/policy/scope.rb', line 13

def self.build
  instance = new
  instance.configure
  instance
end

.call(record, scope = nil, **options) ⇒ Object



9
10
11
# File 'lib/hubbado/policy/scope.rb', line 9

def self.call(record, scope = nil, **options)
  build.(record, scope, **options)
end

Instance Method Details

#call(record, scope = nil, **options) ⇒ Object



22
23
24
25
26
# File 'lib/hubbado/policy/scope.rb', line 22

def call(record, scope = nil, **options)
  scope ||= self.class.default_scope

  resolve(record, scope, **options)
end