Class: Olivander::CurrentContext

Inherits:
ActiveSupport::CurrentAttributes
  • Object
show all
Defined in:
lib/olivander/application_context.rb

Overview

DTO for state in the current thread of execution

Constant Summary collapse

DEFAULT_USER_DISPLAY =
'No User Set'

Instance Method Summary collapse

Instance Method Details

#build {|_self, application_context, user, ability| ... } ⇒ Object

Yields:

  • (_self, application_context, user, ability)

Yield Parameters:



114
115
116
117
118
119
120
# File 'lib/olivander/application_context.rb', line 114

def build
  self.application_context ||= ::Olivander::ApplicationContext.new
  self.user ||= build_dummy_user
  self.ability ||= build_dummy_ability
  yield(self, application_context, user, ability) if block_given?
  self
end