async-tools 0.1.4 → 0.1.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0b6a9e60ce38ea15b2fa51b01682f765fde14870e4a7df8bd117e2854e450d5
4
- data.tar.gz: b2ae55f1231cd2b4c5906ed4a93031df8ee60e116c6f81e703de903823fe71d4
3
+ metadata.gz: 76687d5e9ac4df8655c6253762cc47a84f36c05a163240f4d7b6ab81c31bc055
4
+ data.tar.gz: 6a2faf932cd588989ff86ac47468e46f8c3571c3b3880d46b5505fe51973eb70
5
5
  SHA512:
6
- metadata.gz: dfb0c073879c4e8d0a48e7999716fe74315b7194c29b2789b10d84fcde52c3d774a1b5fb510ec608a0d196e0cee906df1c3db643e422e7a8df84d318d903379f
7
- data.tar.gz: 1f4ae1c4e83c11804ab6ed44fe09e1de0376f097282239dfca733d814d0c6cc361643a4236328b4082bf48f1303cefa88c1dc7f9242b688425d5e42cb4883eb7
6
+ metadata.gz: 46d9a99e8aa5a058048b1ee02298a1bdfb1ef1cc77b149cc79ab1f284932bbbf53a2e4ec7cee53a7ee3a8782f26a53ad5666db7c5f59663e901164d423bc074f
7
+ data.tar.gz: cdbd6412192ea4d432ebe193378819bf9093183b6cf3e427431fd3a70b3667693d83efc9926e1de834a74e8daea6e5a997d78406c79a4580cff1cb0d150ad3c8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- async-tools (0.1.4)
4
+ async-tools (0.1.6)
5
5
  async (~> 2.3)
6
6
  zeitwerk (~> 2.6)
7
7
 
data/lib/async/bus/bus.rb CHANGED
@@ -5,9 +5,11 @@ class Async::Bus::Bus
5
5
 
6
6
  include Console
7
7
 
8
- def initialize(name: :default, limit: 10)
8
+ def initialize(name: :default, limit: 10, parent: Async::Task.current)
9
9
  @name = name
10
10
  @limit = limit
11
+ @parent = parent
12
+
11
13
  @closed = false
12
14
 
13
15
  @subscribers = Hash.new { |hash, key| hash[key] = [] }
@@ -43,7 +45,7 @@ class Async::Bus::Bus
43
45
  serve(chan, event_name, callable)
44
46
  end
45
47
 
46
- def async_subscribe(*, **, &) = Async { subscribe(*, **, &) }
48
+ def async_subscribe(*, **, &) = @parent.async { subscribe(*, **, &) }
47
49
  def on_event(&block) = @on_event_callback = block
48
50
 
49
51
  def close
data/lib/async/channel.rb CHANGED
@@ -77,7 +77,7 @@ class Async::Channel
77
77
  @subscribers -= 1
78
78
  end
79
79
 
80
- def async(parent: (@parent || Task.current), &block)
80
+ def async(parent: (@parent || Async::Task.current), &block)
81
81
  each do |item|
82
82
  parent.async(item, &block)
83
83
  end
data/lib/async/timer.rb CHANGED
@@ -39,7 +39,7 @@ class Async::Timer
39
39
  call if @run_on_start || run
40
40
 
41
41
  loop do
42
- @parent.sleep(@delay)
42
+ sleep(@delay)
43
43
  call
44
44
  break unless @repeat
45
45
  rescue Async::Stop, Async::TimeoutError
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Async # rubocop:disable Style/ClassAndModuleChildren
4
4
  module Tools
5
- VERSION = "0.1.4"
5
+ VERSION = "0.1.6"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gleb Sinyavskiy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-25 00:00:00.000000000 Z
11
+ date: 2023-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async