Module: PactBroker::Repositories::Scopes

Instance Method Summary collapse

Instance Method Details

#scope_for(scope) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/pact_broker/repositories/scopes.rb', line 11

def scope_for(scope)
  if @unscoped == true
    scope
  else
    PactBroker.policy_scope!(scope)
  end
end

#unscoped(scope) ⇒ Object

For the times when it doesn’t make sense to use the scoped class, this is a way to indicate that it is an intentional use



21
22
23
# File 'lib/pact_broker/repositories/scopes.rb', line 21

def unscoped(scope)
  scope
end

#with_no_scopeObject



4
5
6
7
8
9
# File 'lib/pact_broker/repositories/scopes.rb', line 4

def with_no_scope
  @unscoped = true
  yield self
ensure
  @unscoped = false
end