startback 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c8384cd6e24cd8fd0c1c6ac4b2361e6d96e36267fda450ba0628f3c58674106
4
- data.tar.gz: e70ab5bd8c0fcb84edb6e4abd510cd88493df60b6c3faf595e015e047c2f5864
3
+ metadata.gz: a162a8ab216ec2a85da27179246324ec3d9a4e9f3a8b4b169b3ecb62d30c2718
4
+ data.tar.gz: '08018c87f0feb186e026bd03ee3393c546ba7172660bb6bdf9ba759c4b0b9cf9'
5
5
  SHA512:
6
- metadata.gz: e2f8f4bd5413b19f1cc7abc8930f917ee32cdfc6cb491003b6cbbaa2623fa88ac333bffad08e618f7bcf8ff67948d8fd84cc0232dd6632b0b68a41525d85bea4
7
- data.tar.gz: abe4b7dc61b8c21d8ad45aa7d493ff9c6c867534af7bba41786c374728465272a91fc99628659df79712f3441e8e729e8aa50f7bd2c31acd6f584685f2772937
6
+ metadata.gz: 7fca430945a88c9c6eddb3ad2f1907854a3e6f6f08246a2d9358ffeb953c9eff94bf3e4b75cdaee3344e264d8509019877a3e769e3ae5cd8b00177f98ed3dee4
7
+ data.tar.gz: 7c750aa83925058090b685b44e4d14b7a2f836d98de3e10741c76c7d0ef0f6bf337654a798dbda7c2bfb2ad92eb3b3a189fdea09ea8e62eff8ecd174e7a5621b
@@ -97,6 +97,10 @@ module Startback
97
97
  @bunny.close if @bunny
98
98
  end
99
99
 
100
+ def connected?
101
+ @bunny && @bunny.connected?
102
+ end
103
+
100
104
  def channel
101
105
  unless @bunny
102
106
  raise Startback::Errors::Error, "Please connect your bus first, or use autoconnect: true"
@@ -24,6 +24,10 @@ module Startback
24
24
  def connect
25
25
  end
26
26
 
27
+ def connected?
28
+ true
29
+ end
30
+
27
31
  def emit(event)
28
32
  (@listeners[event.type.to_s] || []).each do |l|
29
33
  stop_errors(self, "emit", event) {
@@ -16,6 +16,10 @@ module Startback
16
16
  def connect
17
17
  end
18
18
 
19
+ def connected?
20
+ true
21
+ end
22
+
19
23
  def emit(event)
20
24
  (@listeners[event.type.to_s] || []).each do |l|
21
25
  l.call(event)
@@ -69,6 +69,16 @@ module Startback
69
69
  async.connect if async
70
70
  end
71
71
 
72
+ def connected?
73
+ if sync && async
74
+ sync.connected? && async.connected?
75
+ elsif sync
76
+ sync.connected?
77
+ elsif async
78
+ async.connected?
79
+ end
80
+ end
81
+
72
82
  # Emits a particular event to the listeners.
73
83
  #
74
84
  # @arg event an event, should be an Event instance (through duck
@@ -2,7 +2,7 @@ module Startback
2
2
  module Version
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- TINY = 1
5
+ TINY = 2
6
6
  end
7
7
  VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::TINY}"
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: startback
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-25 00:00:00.000000000 Z
11
+ date: 2024-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec