signalize 1.0.1 → 1.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 +4 -4
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +3 -1
- data/README.md +0 -4
- data/lib/signalize/version.rb +1 -1
- data/lib/signalize.rb +20 -13
- data/signalize.gemspec +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 023d2e474c347003b12bef1210945016175838261a5761dae81cb90d749fe51b
|
4
|
+
data.tar.gz: 04adf75c67d46adf30fabfdf996eea3ef1555678f96189444d32355571c5d12d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c6cc8aad7188bde45f3c5e535d8a7c9ceb17e0598f35ebe45791cf194b8489e799fb32680c130f4bd3f0c06e399ae900bfa8dd103fd7431fe779856fb1685cc
|
7
|
+
data.tar.gz: e3eacdfae3cecd69c3b17158e4ae5610119d83e778e369479c487a1ac42e88dcb554cb9c3389cf4d1e1689a337f1bab2f0e02230d6a22b59df3b4bb2993069c3
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
1
3
|
## [Unreleased]
|
2
4
|
|
5
|
+
## [1.1.0] - 2023-03-25
|
6
|
+
|
7
|
+
- Provide better signal/computed inspect strings (fixes #1)
|
8
|
+
- Use Concurrent::Map for thread-safe globals (fixes #3)
|
9
|
+
|
10
|
+
## [1.0.1] - 2023-03-08
|
11
|
+
|
12
|
+
- Prevent early returns in effect blocks
|
13
|
+
- Use gem's error class (fixes #2)
|
14
|
+
|
3
15
|
## [1.0.0] - 2023-03-07
|
4
16
|
|
5
17
|
- Initial release
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -248,7 +248,3 @@ This project is intended to be a safe, welcoming space for collaboration, and co
|
|
248
248
|
## License
|
249
249
|
|
250
250
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
251
|
-
|
252
|
-
## Code of Conduct
|
253
|
-
|
254
|
-
Everyone interacting in the Signalize project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/whitefusionhq/signalize/blob/main/CODE_OF_CONDUCT.md).
|
data/lib/signalize/version.rb
CHANGED
data/lib/signalize.rb
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "concurrent"
|
3
4
|
require_relative "signalize/version"
|
4
5
|
|
5
6
|
module Signalize
|
6
7
|
class Error < StandardError; end
|
7
8
|
|
8
9
|
class << self
|
9
|
-
def
|
10
|
+
def global_map_accessor(name)
|
10
11
|
define_singleton_method "#{name}" do
|
11
|
-
|
12
|
+
GLOBAL_MAP[name]
|
12
13
|
end
|
13
14
|
define_singleton_method "#{name}=" do |value|
|
14
|
-
|
15
|
+
GLOBAL_MAP[name] = value
|
15
16
|
end
|
16
17
|
end
|
17
18
|
end
|
@@ -27,24 +28,26 @@ module Signalize
|
|
27
28
|
HAS_ERROR = 1 << 4
|
28
29
|
TRACKING = 1 << 5
|
29
30
|
|
31
|
+
GLOBAL_MAP = Concurrent::Map.new
|
32
|
+
|
30
33
|
# Computed | Effect | nil
|
31
|
-
|
32
|
-
|
34
|
+
global_map_accessor :eval_context
|
35
|
+
self.eval_context = nil
|
33
36
|
|
34
37
|
# Effects collected into a batch.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
global_map_accessor :batched_effect
|
39
|
+
self.batched_effect = nil
|
40
|
+
global_map_accessor :batch_depth
|
41
|
+
self.batch_depth = 0
|
42
|
+
global_map_accessor :batch_iteration
|
43
|
+
self.batch_iteration = 0
|
41
44
|
|
42
45
|
# NOTE: we have removed the global version optimization for Ruby, due to
|
43
46
|
# the possibility of long-running server processes and the number reaching
|
44
47
|
# a dangerously high integer value.
|
45
48
|
#
|
46
|
-
#
|
47
|
-
#
|
49
|
+
# global_map_accessor :global_version
|
50
|
+
# self.global_version = 0
|
48
51
|
|
49
52
|
Node = Struct.new(
|
50
53
|
:_version,
|
@@ -436,6 +439,10 @@ module Signalize
|
|
436
439
|
end
|
437
440
|
|
438
441
|
def peek = @value
|
442
|
+
|
443
|
+
def inspect
|
444
|
+
"#<#{self.class} value: #{peek.inspect}>"
|
445
|
+
end
|
439
446
|
end
|
440
447
|
|
441
448
|
class Computed < Signal
|
data/signalize.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.require_paths = ["lib"]
|
28
28
|
|
29
29
|
# Uncomment to register a new dependency of your gem
|
30
|
-
|
30
|
+
spec.add_dependency "concurrent-ruby", "~> 1.2"
|
31
31
|
|
32
32
|
# For more information and examples about making a new gem, check out our
|
33
33
|
# guide at: https://bundler.io/guides/creating_gem.html
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: signalize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared White
|
@@ -9,8 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-03-
|
13
|
-
dependencies:
|
12
|
+
date: 2023-03-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: concurrent-ruby
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.2'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.2'
|
14
28
|
description: A Ruby port of Signals, providing reactive variables, derived computed
|
15
29
|
state, side effect callbacks, and batched updates.
|
16
30
|
email:
|