fiber-storage 0.1.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/fiber/storage/version.rb +2 -2
- data/lib/fiber/storage.rb +9 -1
- data/license.md +1 -1
- data/readme.md +21 -1
- data.tar.gz.sig +0 -0
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71c43018c492c0e23e2a1b78388e7df6406da28fe90e330206eb9e1d5623b1f5
|
4
|
+
data.tar.gz: f9097500200623a27c05f752062f0602daf5dd00f4b0d31971811c96119ecddd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1af6795e0b5b13d33cb9a5902195c956bc14f7966f17c3f6479da9626d5cebbe07d454e26a4cde60f2418ee7cf41d1483bf1b67fa918f03d90fe20322c3cd427
|
7
|
+
data.tar.gz: 3022888f880101f4ef125def7601607d5e8a605c5cae0796cdb15f337717c2fd99a55d4fd6ade1140b88f298e27e7dbe44a7e3741d1a013e395d7e8e6eddf3b2
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2022-
|
4
|
+
# Copyright, 2022-2024, by Samuel Williams.
|
5
5
|
|
6
6
|
require 'fiber'
|
7
7
|
|
8
8
|
class Fiber
|
9
9
|
module Storage
|
10
|
-
VERSION = "0.
|
10
|
+
VERSION = "1.0.0"
|
11
11
|
end
|
12
12
|
end
|
data/lib/fiber/storage.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2022-
|
4
|
+
# Copyright, 2022-2024, by Samuel Williams.
|
5
5
|
|
6
6
|
require 'fiber'
|
7
7
|
|
8
|
+
# @namespace
|
8
9
|
class Fiber
|
10
|
+
# Provides compatibility shims for fiber storage.
|
9
11
|
module Storage
|
12
|
+
# Initialize the fiber with the given storage.
|
10
13
|
def initialize(*arguments, storage: true, **options, &block)
|
11
14
|
case storage
|
12
15
|
when true
|
@@ -30,6 +33,7 @@ class Fiber
|
|
30
33
|
@storage.dup
|
31
34
|
end
|
32
35
|
|
36
|
+
# @private
|
33
37
|
def __storage__
|
34
38
|
@storage ||= {}
|
35
39
|
end
|
@@ -52,6 +56,7 @@ class Fiber
|
|
52
56
|
self.current.__storage__[key] = value
|
53
57
|
end
|
54
58
|
else
|
59
|
+
# Whether the fiber storage has buggy keys. Unfortunately the original implementation of fiber storage was broken, this method detects the bug and is used to apply a fix.
|
55
60
|
def self.__borked_keys__
|
56
61
|
!Fiber.new do
|
57
62
|
key = :"#{self.object_id}.key"
|
@@ -61,13 +66,16 @@ class Fiber
|
|
61
66
|
end
|
62
67
|
|
63
68
|
if __borked_keys__
|
69
|
+
# This is a fix for the original implementation of fiber storage which incorrectly handled non-dynamic symbol keys.
|
64
70
|
module FixBorkedKeys
|
71
|
+
# Lookup the value for the key, ensuring the symbol is dynamic.
|
65
72
|
def [](key)
|
66
73
|
raise TypeError, "Key must be symbol!" unless key.is_a?(Symbol)
|
67
74
|
|
68
75
|
super(eval(key.inspect))
|
69
76
|
end
|
70
77
|
|
78
|
+
# Assign the value to the key, ensuring the symbol is dynamic.
|
71
79
|
def []=(key, value)
|
72
80
|
raise TypeError, "Key must be symbol!" unless key.is_a?(Symbol)
|
73
81
|
|
data/license.md
CHANGED
data/readme.md
CHANGED
@@ -12,4 +12,24 @@ Notably, it does not support inheritance across threads or lazy Enumerator. This
|
|
12
12
|
|
13
13
|
## Usage
|
14
14
|
|
15
|
-
|
15
|
+
Please see the [project documentation](https://ioquatix.github.io/fiber-storage/) for more details.
|
16
|
+
|
17
|
+
- [Getting Started](https://ioquatix.github.io/fiber-storage/guides/getting-started/index) - This guide explains how to use this gem and provides a brief overview of the features.
|
18
|
+
|
19
|
+
## Contributing
|
20
|
+
|
21
|
+
We welcome contributions to this project.
|
22
|
+
|
23
|
+
1. Fork it.
|
24
|
+
2. Create your feature branch (`git checkout -b my-new-feature`).
|
25
|
+
3. Commit your changes (`git commit -am 'Add some feature'`).
|
26
|
+
4. Push to the branch (`git push origin my-new-feature`).
|
27
|
+
5. Create new Pull Request.
|
28
|
+
|
29
|
+
### Developer Certificate of Origin
|
30
|
+
|
31
|
+
In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
|
32
|
+
|
33
|
+
### Community Guidelines
|
34
|
+
|
35
|
+
This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fiber-storage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -37,7 +37,7 @@ cert_chain:
|
|
37
37
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
38
38
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
39
39
|
-----END CERTIFICATE-----
|
40
|
-
date: 2024-
|
40
|
+
date: 2024-08-08 00:00:00.000000000 Z
|
41
41
|
dependencies: []
|
42
42
|
description:
|
43
43
|
email:
|
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: '0'
|
73
73
|
requirements: []
|
74
|
-
rubygems_version: 3.5.
|
74
|
+
rubygems_version: 3.5.11
|
75
75
|
signing_key:
|
76
76
|
specification_version: 4
|
77
77
|
summary: Provides a compatibility shim for fiber storage.
|
metadata.gz.sig
CHANGED
Binary file
|