Module: HTTPX::Plugins::FiberConcurrency::RequestMethods
- Defined in:
- lib/httpx/plugins/fiber_concurrency.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
the execution context (fiber) this request was sent on.
Instance Method Summary collapse
- #complete!(response = @response) ⇒ Object
-
#current_context? ⇒ Boolean
checks whether the current execution context is the one where the request was created.
- #initialize ⇒ Object
-
#set_context! ⇒ Object
sets the execution context for this request.
Instance Attribute Details
#context ⇒ Object (readonly)
the execution context (fiber) this request was sent on.
42 43 44 |
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 42 def context @context end |
Instance Method Details
#complete!(response = @response) ⇒ Object
59 60 61 62 |
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 59 def complete!(response = @response) @context = nil super end |
#current_context? ⇒ Boolean
checks whether the current execution context is the one where the request was created.
55 56 57 |
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 55 def current_context? @context == Fiber.current end |
#initialize ⇒ Object
44 45 46 47 |
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 44 def initialize(*) super @context = nil end |
#set_context! ⇒ Object
sets the execution context for this request. the default is the current fiber.
50 51 52 |
# File 'lib/httpx/plugins/fiber_concurrency.rb', line 50 def set_context! @context ||= Fiber.current # rubocop:disable Naming/MemoizedInstanceVariableName end |