always 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/always.gemspec +1 -1
- data/lib/always.rb +3 -3
- data/test/test_always.rb +11 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed19cd7a3109c141b0537f2229876cc00f5d0a70740095b810b281c47fe44834
|
4
|
+
data.tar.gz: 793763757135f8492edb8bb6b6abb6b9ee19459c7e35d3acde3ac13f0c97a230
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c09324fe351d257d252e466e9be7d263ffb0e9781d1134b777ae207ee0321779273b82771d595fad47f4ca67ed2bebbc4a8864758c0f522f0233f66b5745b79
|
7
|
+
data.tar.gz: 44c0a7f8d9117e69845c58577b6f40ccd29f7292e07c9df0cc18a05870a3fb4b5795c85cc0bfcd5434c543ed5575a081b35de6cc7a402ef59d70459ac87659de
|
data/always.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
27
27
|
s.required_ruby_version = '>=3.2'
|
28
28
|
s.name = 'always'
|
29
|
-
s.version = '0.0.
|
29
|
+
s.version = '0.0.3'
|
30
30
|
s.license = 'MIT'
|
31
31
|
s.summary = 'A simple Ruby framework that spins a loop forever, in a background thread'
|
32
32
|
s.description =
|
data/lib/always.rb
CHANGED
@@ -44,7 +44,7 @@ require 'concurrent/atom'
|
|
44
44
|
# License:: MIT
|
45
45
|
class Always
|
46
46
|
# The version of the framework.
|
47
|
-
VERSION = '0.0.
|
47
|
+
VERSION = '0.0.3'
|
48
48
|
|
49
49
|
# Constructor.
|
50
50
|
# @param [Integer] total The number of threads to run
|
@@ -78,12 +78,12 @@ class Always
|
|
78
78
|
|
79
79
|
# Start them all.
|
80
80
|
# @param [Integer] pause The delay between cycles, in seconds
|
81
|
-
def start(pause = 0)
|
81
|
+
def start(pause = 0, &)
|
82
82
|
raise 'It is running now, call .stop() first' unless @threads.empty?
|
83
83
|
|
84
84
|
(0..@total - 1).each do |i|
|
85
85
|
@threads[i] = Thread.new do
|
86
|
-
body(i, pause)
|
86
|
+
body(i, pause, &)
|
87
87
|
@cycles.swap { |c| c + 1 }
|
88
88
|
end
|
89
89
|
end
|
data/test/test_always.rb
CHANGED