File: request.rb

package info (click to toggle)
ruby-fiber-local 1.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 132 kB
  • sloc: ruby: 125; makefile: 4
file content (25 lines) | stat: -rw-r--r-- 373 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2021, by Samuel Williams.

require_relative '../lib/fiber/local'

require 'securerandom'

module RequestID
	extend Fiber::Local
end

Fiber.new do
	RequestID.instance = SecureRandom.uuid
	
	pp RequestID.instance
	
	pp Fiber.current
	
	Fiber.new do
		pp RequestID.instance
	end.resume
end.resume