fiber-annotate 0.1.0
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 +7 -0
- checksums.yaml.gz.sig +0 -0
- data/lib/fiber/annotate/version.rb +10 -0
- data/lib/fiber/annotate.rb +60 -0
- data/license.md +21 -0
- data/readme.md +19 -0
- data.tar.gz.sig +2 -0
- metadata +76 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2771308d37e19188de7bfcfa0a3394ecadd316c4cc5a1bd59912662cc32f5aae
|
4
|
+
data.tar.gz: af8aba51d3764addb8baad00cd2345a3309ce9cb0ad2e7289d0031ffe5b33e32
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 65399d02b1ff47a25b4cc65c405961c2917497ddc5471d6fdf7d5ac9f768a117c5c08423b4cc1bab00c5f41ef8fcb280d13822d76c0453691433d7acf6ca39cc
|
7
|
+
data.tar.gz: f05cf4b6afaca93c7227fd9f9aa43609a6bad2400758c2c5fce90ca12c30e7d21516954c4ff1954cc77839765bd06da18c29d8c51ba7e2078338d9745ebaa801
|
checksums.yaml.gz.sig
ADDED
Binary file
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2023, by Samuel Williams.
|
5
|
+
|
6
|
+
require 'fiber'
|
7
|
+
|
8
|
+
class Fiber
|
9
|
+
# A mechanism for annotating fibers.
|
10
|
+
module Annotate
|
11
|
+
# Annotate the current fiber with the given annotation.
|
12
|
+
# @parameter annotation [Object] The annotation to set.
|
13
|
+
def initialize(annotation: nil, **options, &block)
|
14
|
+
@annotation = annotation
|
15
|
+
super(**options, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Get the current annotation.
|
19
|
+
# @returns [Object] The current annotation.
|
20
|
+
def annotation
|
21
|
+
@annotation
|
22
|
+
end
|
23
|
+
|
24
|
+
# Annotate the current fiber with the given annotation.
|
25
|
+
#
|
26
|
+
# If a block is given, the annotation is set for the duration of the block and then restored.
|
27
|
+
#
|
28
|
+
# This method should only be invoked on the current fiber.
|
29
|
+
#
|
30
|
+
# @parameter annotation [Object] The annotation to set.
|
31
|
+
# @yields {} The block to execute with the given annotation.
|
32
|
+
# @returns [Object] The return value of the block.
|
33
|
+
def annotate(annotation)
|
34
|
+
raise "Cannot annotate a different fiber!" unless Fiber.current == self
|
35
|
+
|
36
|
+
if block_given?
|
37
|
+
begin
|
38
|
+
current_annotation = @annotation
|
39
|
+
@annotation = annotation
|
40
|
+
return yield
|
41
|
+
ensure
|
42
|
+
@annotation = current_annotation
|
43
|
+
end
|
44
|
+
else
|
45
|
+
@annotation = annotation
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
unless Fiber.method_defined?(:annotation)
|
52
|
+
Fiber.prepend(Fiber::Annotate)
|
53
|
+
|
54
|
+
# @scope Fiber
|
55
|
+
# @name self.annotate
|
56
|
+
# Annotate the current fiber with the given annotation.
|
57
|
+
def Fiber.annotate(...)
|
58
|
+
Fiber.current.annotate(...)
|
59
|
+
end
|
60
|
+
end
|
data/license.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# MIT License
|
2
|
+
|
3
|
+
Copyright, 2023, by Samuel Williams.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/readme.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Fiber::Annotate
|
2
|
+
|
3
|
+
A simple way to annotate what a fiber is currently doing, useful for debugging.
|
4
|
+
|
5
|
+
[](https://github.com/ioquatix/fiber-annotate/actions?workflow=Test)
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
Please see the [project documentation](https://ioquatix.github.io/fiber-annotate).
|
10
|
+
|
11
|
+
## Contributing
|
12
|
+
|
13
|
+
We welcome contributions to this project.
|
14
|
+
|
15
|
+
1. Fork it.
|
16
|
+
2. Create your feature branch (`git checkout -b my-new-feature`).
|
17
|
+
3. Commit your changes (`git commit -am 'Add some feature'`).
|
18
|
+
4. Push to the branch (`git push origin my-new-feature`).
|
19
|
+
5. Create new Pull Request.
|
data.tar.gz.sig
ADDED
@@ -0,0 +1,2 @@
|
|
1
|
+
���VL�nD��n��
|
2
|
+
��7�/���Es�lh��z�p�"����B_�%����ڍ�&�B��J�AAz��_Y��X��tZl�Z������ [��2�/q�6��zq���P��@��#(�UM+�r���kg������Q�C�C���]c�:����f�1�g�J��.X�=���}f��vb�����ve���Bk��!4JL�E��A�ʂ3��L|�'yE�zk�1��L��C���ŷ'#�5a�{�JD�Ad�6���Ӱ�=U}���))s�D�:�� [��Z/�gg�<��䐔w(����R�^c��Q6�F���.���?�~��Ŋ��SN�6�lͩPn��a��_���<!�d���Z��M�4�2t.�
|
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fiber-annotate
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Samuel Williams
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
|
14
|
+
ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
|
15
|
+
CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
|
16
|
+
MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
|
17
|
+
MBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj
|
18
|
+
bzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
|
19
|
+
igKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2
|
20
|
+
9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW
|
21
|
+
sGkaOY0eqsQm1pEWkHJr3zn/fxoKPZPfaJOglovdxf7dgsHz67Xgd/ka+Wo1YqoE
|
22
|
+
e5AUKRwUuvaUaumAKgPH+4E4oiLXI4T1Ff5Q7xxv6yXvHuYtlMHhYfgNn8iiW8WN
|
23
|
+
XibYXPNP7NtieSQqwR/xM6IRSoyXKuS+Z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0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
39
|
+
-----END CERTIFICATE-----
|
40
|
+
date: 2023-06-04 00:00:00.000000000 Z
|
41
|
+
dependencies: []
|
42
|
+
description:
|
43
|
+
email:
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- lib/fiber/annotate.rb
|
49
|
+
- lib/fiber/annotate/version.rb
|
50
|
+
- license.md
|
51
|
+
- readme.md
|
52
|
+
homepage: https://github.com/ioquatix/fiber-annotate
|
53
|
+
licenses:
|
54
|
+
- MIT
|
55
|
+
metadata:
|
56
|
+
funding_uri: https://github.com/sponsors/ioquatix/
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '2.7'
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
requirements: []
|
72
|
+
rubygems_version: 3.4.7
|
73
|
+
signing_key:
|
74
|
+
specification_version: 4
|
75
|
+
summary: A mechanism for annotating fibers.
|
76
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|