Module: SolidObjects::Context
- Defined in:
- lib/solid_objects/context.rb,
sig/generated/lib/solid_objects/context.rbs
Defined Under Namespace
Classes: Frame
Constant Summary collapse
- STORAGE_KEY =
:solid_objects_context
Class Method Summary collapse
- .authorization_context ⇒ Object
- .current ⇒ Frame?
- .current_actor ⇒ Actor?
- .current_message ⇒ MessageContext?
- .with(actor:, message:, authorization_context: nil) { ... } ⇒ Object
Class Method Details
.authorization_context ⇒ Object
27 28 29 |
# File 'lib/solid_objects/context.rb', line 27 def current&. end |
.current ⇒ Frame?
12 13 14 |
# File 'lib/solid_objects/context.rb', line 12 def current ActiveSupport::IsolatedExecutionState[STORAGE_KEY] end |
.current_actor ⇒ Actor?
17 18 19 |
# File 'lib/solid_objects/context.rb', line 17 def current_actor current&.actor end |
.current_message ⇒ MessageContext?
22 23 24 |
# File 'lib/solid_objects/context.rb', line 22 def current&. end |
.with(actor:, message:, authorization_context: nil) { ... } ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/solid_objects/context.rb', line 32 def with(actor:, message:, authorization_context: nil) previous = current ActiveSupport::IsolatedExecutionState[STORAGE_KEY] = Frame.new(actor:, message:, authorization_context:) yield ensure ActiveSupport::IsolatedExecutionState[STORAGE_KEY] = previous end |