fiber-storage 0.1.2 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/fiber/storage/version.rb +3 -3
- data/lib/fiber/storage.rb +10 -2
- data/license.md +1 -1
- data/readme.md +29 -1
- data/releases.md +5 -0
- data.tar.gz.sig +0 -0
- metadata +6 -9
- 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: 042bf955c9fb6f27e51d670084140c310c49dd704d546ecb73a57212237a593e
|
4
|
+
data.tar.gz: 928f054fbebf8ea89c7c352117456c173b72bdd99d360333e648528eac8198d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 564606b82a689fcfaccf9361d954c2e1bcacff6b849107b3b542297cfca111e642cefd98f8c4f5d05b5158283026ef4b479334c940b484f37bf0ce467246d405
|
7
|
+
data.tar.gz: 8fc124f1c97a41bccc34acb27b9d2c218de6d69b3fc5ae21ba6659bb444f0780362ea041a1a7644ad95b33d10733fa33ca9e087dc60af77beb344df9f8915a09
|
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-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
6
|
+
require "fiber"
|
7
7
|
|
8
8
|
class Fiber
|
9
9
|
module Storage
|
10
|
-
VERSION = "0.1
|
10
|
+
VERSION = "1.0.1"
|
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-2025, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
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,32 @@ 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
|
+
## Releases
|
20
|
+
|
21
|
+
Please see the [project releases](https://ioquatix.github.io/fiber-storage/releases/index) for all releases.
|
22
|
+
|
23
|
+
### v1.0.1
|
24
|
+
|
25
|
+
- Fix test suite incompatibiltiies with Ruby 3.4+.
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
We welcome contributions to this project.
|
30
|
+
|
31
|
+
1. Fork it.
|
32
|
+
2. Create your feature branch (`git checkout -b my-new-feature`).
|
33
|
+
3. Commit your changes (`git commit -am 'Add some feature'`).
|
34
|
+
4. Push to the branch (`git push origin my-new-feature`).
|
35
|
+
5. Create new Pull Request.
|
36
|
+
|
37
|
+
### Developer Certificate of Origin
|
38
|
+
|
39
|
+
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.
|
40
|
+
|
41
|
+
### Community Guidelines
|
42
|
+
|
43
|
+
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/releases.md
ADDED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fiber-storage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain:
|
11
10
|
- |
|
@@ -37,10 +36,8 @@ cert_chain:
|
|
37
36
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
38
37
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
39
38
|
-----END CERTIFICATE-----
|
40
|
-
date:
|
39
|
+
date: 2025-04-15 00:00:00.000000000 Z
|
41
40
|
dependencies: []
|
42
|
-
description:
|
43
|
-
email:
|
44
41
|
executables: []
|
45
42
|
extensions: []
|
46
43
|
extra_rdoc_files: []
|
@@ -49,14 +46,15 @@ files:
|
|
49
46
|
- lib/fiber/storage/version.rb
|
50
47
|
- license.md
|
51
48
|
- readme.md
|
49
|
+
- releases.md
|
52
50
|
homepage: https://github.com/ioquatix/fiber-storage
|
53
51
|
licenses:
|
54
52
|
- MIT
|
55
53
|
metadata:
|
54
|
+
homepage_uri: https://github.com/ioquatix/fiber-storage
|
56
55
|
documentation_uri: https://ioquatix.github.io/fiber-storage/
|
57
56
|
funding_uri: https://github.com/sponsors/ioquatix/
|
58
57
|
source_code_uri: https://github.com/ioquatix/fiber-storage.git
|
59
|
-
post_install_message:
|
60
58
|
rdoc_options: []
|
61
59
|
require_paths:
|
62
60
|
- lib
|
@@ -64,15 +62,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
62
|
requirements:
|
65
63
|
- - ">="
|
66
64
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
65
|
+
version: '3.1'
|
68
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
67
|
requirements:
|
70
68
|
- - ">="
|
71
69
|
- !ruby/object:Gem::Version
|
72
70
|
version: '0'
|
73
71
|
requirements: []
|
74
|
-
rubygems_version: 3.
|
75
|
-
signing_key:
|
72
|
+
rubygems_version: 3.6.2
|
76
73
|
specification_version: 4
|
77
74
|
summary: Provides a compatibility shim for fiber storage.
|
78
75
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|