em-cron 0.1.1 → 0.2.0

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
  SHA1:
3
- metadata.gz: 6692f601f631600ba010035b84e63f26a21c41aa
4
- data.tar.gz: 438ba0e58e260ead5d8403f64112ca8adcff29f3
3
+ metadata.gz: c1eedceca43175a280164d363045834b501a5ff0
4
+ data.tar.gz: 0d75db6f5210db15afbc56c0bcdccc4a226e9f22
5
5
  SHA512:
6
- metadata.gz: 15501938567466421876c62a6c7f7fc4b16ea887ae6b21b966c35fd02d7058c16be1b578b52157ca5beb3ed74652346e6ff09fe07d1ad9a59effe56a541b004c
7
- data.tar.gz: 269d5f8ecb143f37656375f8db427c7e55cd0ddba61cc4a1867160fe43a0d2853b0ad5d5c9aaa2b4e491b7eee7baf7736cd1623da20bbcceadca36aaecb949e0
6
+ metadata.gz: fe11a206325109ba1eed2440b0acdeda0cb74f128742a5a60907214396c79e240d55fbaf3ddd1bcfdb2722a3cbddeedc00986541547fda755a95faaa47c47f1a
7
+ data.tar.gz: 06724eaea1103b36223aac48b83bcb2d728ab0abd2e315cec935ccaf32522e0d4b6cfddbcaf9208dc2c9ef7f4983966a647aa7b19a035bb87ff50a508f21d54b
@@ -5,7 +5,8 @@ require "em/cron/version"
5
5
  module EM
6
6
  class Cron
7
7
  # @param cron_string [String]
8
- # @yield [Time] the time the block was scheduled to be called by cron
8
+ # @yield [Time] the time the block was scheduled to be called by cron. If
9
+ # yielding this block returns `:stop` then the schedule stops.
9
10
  # @example
10
11
  # EM.run do
11
12
  # EM::Cron.schedule("* * * * *") do |time|
@@ -16,8 +17,8 @@ module EM
16
17
  cron_parser = CronParser.new(cron_string)
17
18
  next_time = cron_parser.next(Time.now)
18
19
  EM.add_timer(next_time - Time.now) do
19
- yield(next_time)
20
- schedule(cron_string, &blk)
20
+ result = yield(next_time)
21
+ schedule(cron_string, &blk) unless result == :stop
21
22
  end
22
23
  end
23
24
  end
@@ -2,6 +2,6 @@ require 'eventmachine'
2
2
 
3
3
  module EM
4
4
  class Cron
5
- VERSION = "0.1.1"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-cron
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dylan Griffith
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-24 00:00:00.000000000 Z
11
+ date: 2015-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parse-cron