Module: Authlogic::Session::Scopes::ClassMethods

Defined in:
lib/authlogic/session/scopes.rb

Overview

Scopes

Instance Method Summary collapse

Instance Method Details

#scopeObject

The current scope set, should be used in the block passed to with_scope.


59
60
61
# File 'lib/authlogic/session/scopes.rb', line 59

def scope
  Thread.current[:authlogic_scope]
end

#with_scope(options = {}, &block) ⇒ Object

See the documentation for this class for more information on how to use this method.

Raises:

  • (ArgumentError)

64
65
66
67
68
69
70
# File 'lib/authlogic/session/scopes.rb', line 64

def with_scope(options = {}, &block)
  raise ArgumentError.new("You must provide a block") unless block_given?
  self.scope = options
  result = yield
  self.scope = nil
  result
end