async-tools 0.1.6 → 0.1.7

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: 76687d5e9ac4df8655c6253762cc47a84f36c05a163240f4d7b6ab81c31bc055
4
- data.tar.gz: 6a2faf932cd588989ff86ac47468e46f8c3571c3b3880d46b5505fe51973eb70
3
+ metadata.gz: 076d4f7b65287933136f3f2f05417e77dcd548bbe1eb9bfb475eff44b6003891
4
+ data.tar.gz: 18c1b63f416d4890b7696a3a3ba94de0e8cb0df7ccb6e115fe328127f7f93e9d
5
5
  SHA512:
6
- metadata.gz: 46d9a99e8aa5a058048b1ee02298a1bdfb1ef1cc77b149cc79ab1f284932bbbf53a2e4ec7cee53a7ee3a8782f26a53ad5666db7c5f59663e901164d423bc074f
7
- data.tar.gz: cdbd6412192ea4d432ebe193378819bf9093183b6cf3e427431fd3a70b3667693d83efc9926e1de834a74e8daea6e5a997d78406c79a4580cff1cb0d150ad3c8
6
+ metadata.gz: 4a32fb5123b0d520ffd436e07b2003b116f9e3883b386048bb24e4b1327fbcb8de593573a8b00170859c0fef6c18f880ad79d7d78d77dd0446355d55c9ec2545
7
+ data.tar.gz: 918a7bfb836f8a4725dc2b7869aaa4879a74918267cfb7c9cf07a9d73a218a626bed0d75f83373dd008ad59ebce7273949364ac27471cda4ab8e395cd1c678e9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- async-tools (0.1.6)
4
+ async-tools (0.1.7)
5
5
  async (~> 2.3)
6
6
  zeitwerk (~> 2.6)
7
7
 
data/lib/async/timer.rb CHANGED
@@ -7,20 +7,21 @@ class Async::Timer
7
7
 
8
8
  class AlreadyStarted < Error; end
9
9
 
10
- def initialize(delay, repeat: true, start: true, run_on_start: false, parent: Async::Task.current, &block)
11
- raise ArgumentError, "Block must be given" if block.nil?
10
+ def initialize(delay, repeat: true, start: true, run_on_start: false, parent: Async::Task.current, call: nil, &block) # rubocop:disable Metrics/ParameterLists
11
+ callables = [call, block]
12
+ raise ArgumentError, "either block or call: must be given" if callables.all?(&:nil?) || callables.none?(&:nil?)
12
13
 
13
14
  @delay = delay
14
15
  @repeat = repeat
15
16
  @run_on_start = run_on_start
16
17
  @parent = parent
17
- @block = block
18
+ @callable = call || block
18
19
 
19
20
  self.start if start
20
21
  end
21
22
 
22
23
  def stop = @task.stop
23
- def call = @block.call
24
+ def call = @callable.call
24
25
 
25
26
  def active? = @active
26
27
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Async # rubocop:disable Style/ClassAndModuleChildren
4
4
  module Tools
5
- VERSION = "0.1.6"
5
+ VERSION = "0.1.7"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gleb Sinyavskiy