tiny_bus 1.0.4 → 2.0.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/lib/tiny_bus.rb +8 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 523256349438598095486d3bcdff8fc0df0c5c2375fef06402bd2385cbeb14e6
|
4
|
+
data.tar.gz: e832821fc355d7bf69a5378601bbc90c16439d683583b189d1f07be8481eccdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7dc510d91314737850e511ab0e20b3c664ee8950766880a28b128f9b518fb0188acd0bd0c735ec7834c4c78650809f527352c42477fadaba1427f9c2714b127
|
7
|
+
data.tar.gz: fb351e69dacf513efc9198e67a3f6a5fd602f2d7924bcf7f1d3e5a9dfe62116892f360519d7863f6294b8aba65e56c9ee50796d7c6b7f9c5f68c4d8cf8494551
|
data/lib/tiny_bus.rb
CHANGED
@@ -3,6 +3,8 @@ require 'set'
|
|
3
3
|
require 'securerandom'
|
4
4
|
require 'tiny_log'
|
5
5
|
|
6
|
+
# NOTE: This library depends on the TinyLog library.
|
7
|
+
#
|
6
8
|
# This class implements a very simpler PubSub system where:
|
7
9
|
# - subscribers can subscribe via the #sub method
|
8
10
|
# - subscribers can unsubscribe via the #unsub method
|
@@ -25,11 +27,11 @@ require 'tiny_log'
|
|
25
27
|
# TinyBus.new(raise_on_dead: true) # strict mode for undeliverable messages, defaults to false
|
26
28
|
class TinyBus
|
27
29
|
# log:
|
28
|
-
# if specified it should be a
|
29
|
-
# if not specified will
|
30
|
+
# if specified, it should be a TinyLog instance
|
31
|
+
# if not specified, it will create a new TinyLog instance for $stdout
|
30
32
|
# dead:
|
31
|
-
# if specified it should be a
|
32
|
-
# if not specified will
|
33
|
+
# if specified, it should be a TinyLog instance
|
34
|
+
# if not specified, it will create a new TinyLog instance for $stderr
|
33
35
|
# raise_on_dead:
|
34
36
|
# kind of a strict mode. if false, then messages with a topic with no
|
35
37
|
# subscribers will go to the dead file. if true, then messages with a topic
|
@@ -37,8 +39,8 @@ class TinyBus
|
|
37
39
|
def initialize(log: nil, dead: nil, raise_on_dead: false)
|
38
40
|
@subs = {}
|
39
41
|
@stats = { '.dead' => 0 }
|
40
|
-
@log = log
|
41
|
-
@dead = dead
|
42
|
+
@log = log || TinyLog.new($stdout)
|
43
|
+
@dead = dead || TinyLog.new($stderr)
|
42
44
|
@raise_on_dead = raise_on_dead
|
43
45
|
end
|
44
46
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tiny_bus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Lunt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tiny_log
|