timers 4.1.1 → 4.2.0

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.
data/timers.gemspec CHANGED
@@ -1,23 +1,33 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/timers/version', __FILE__)
1
+ # frozen_string_literal: true
2
+ #
3
+ # This file is part of the "timers" project and released under the MIT license.
4
+ #
5
+ # Copyright, 2018, by Samuel Williams. All rights reserved.
6
+ #
3
7
 
4
- Gem::Specification.new do |gem|
5
- gem.authors = ["Tony Arcieri"]
6
- gem.email = ["tony.arcieri@gmail.com"]
7
- gem.description = "Pure Ruby one-shot and periodic timers"
8
- gem.summary = "Schedule procs to run after a certain time, or at periodic intervals, using any API that accepts a timeout"
9
- gem.homepage = "https://github.com/celluloid/timers"
8
+ require_relative 'lib/timers/version'
10
9
 
11
- gem.files = `git ls-files`.split($\)
12
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
- gem.name = "timers"
15
- gem.require_paths = ["lib"]
16
- gem.version = Timers::VERSION
17
- gem.licenses = ['MIT']
10
+ Gem::Specification.new do |spec|
11
+ spec.name = "timers"
12
+ spec.version = Timers::VERSION
13
+ spec.authors = ["Samuel Williams", "Tony Arcieri"]
14
+ spec.email = ["samuel@codeotaku.com", "bascule@gmail.com"]
15
+ spec.licenses = ["MIT"]
16
+ spec.homepage = "https://github.com/socketry/timers"
17
+ spec.summary = "Pure Ruby one-shot and periodic timers"
18
+ spec.description = <<-DESCRIPTION.strip.gsub(/\s+/, " ")
19
+ Schedule procs to run after a certain time, or at periodic intervals,
20
+ using any API that accepts a timeout.
21
+ DESCRIPTION
18
22
 
19
- gem.add_runtime_dependency 'hitimes'
23
+ spec.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
24
+ spec.executables = spec.files.grep(%r{^bin/}).map { |f| File.basename(f) }
25
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
26
+ spec.require_paths = ["lib"]
20
27
 
21
- gem.add_development_dependency 'rake'
22
- gem.add_development_dependency 'rspec', '~> 3.0.0'
28
+ spec.required_ruby_version = '>= 2.2.1'
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.3"
31
+ spec.add_development_dependency "rspec", "~> 3.6"
32
+ spec.add_development_dependency "rake"
23
33
  end
metadata CHANGED
@@ -1,90 +1,90 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timers
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.1
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
+ - Samuel Williams
7
8
  - Tony Arcieri
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-08-21 00:00:00.000000000 Z
12
+ date: 2018-11-06 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
- version_requirements: !ruby/object:Gem::Requirement
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
15
17
  requirements:
16
- - - ">="
18
+ - - "~>"
17
19
  - !ruby/object:Gem::Version
18
- version: '0'
19
- name: hitimes
20
- type: :runtime
20
+ version: '1.3'
21
+ type: :development
21
22
  prerelease: false
22
- requirement: !ruby/object:Gem::Requirement
23
+ version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
- - - ">="
25
+ - - "~>"
25
26
  - !ruby/object:Gem::Version
26
- version: '0'
27
+ version: '1.3'
27
28
  - !ruby/object:Gem::Dependency
28
- version_requirements: !ruby/object:Gem::Requirement
29
+ name: rspec
30
+ requirement: !ruby/object:Gem::Requirement
29
31
  requirements:
30
- - - ">="
32
+ - - "~>"
31
33
  - !ruby/object:Gem::Version
32
- version: '0'
33
- name: rake
34
+ version: '3.6'
34
35
  type: :development
35
36
  prerelease: false
36
- requirement: !ruby/object:Gem::Requirement
37
+ version_requirements: !ruby/object:Gem::Requirement
37
38
  requirements:
38
- - - ">="
39
+ - - "~>"
39
40
  - !ruby/object:Gem::Version
40
- version: '0'
41
+ version: '3.6'
41
42
  - !ruby/object:Gem::Dependency
42
- version_requirements: !ruby/object:Gem::Requirement
43
+ name: rake
44
+ requirement: !ruby/object:Gem::Requirement
43
45
  requirements:
44
- - - "~>"
46
+ - - ">="
45
47
  - !ruby/object:Gem::Version
46
- version: 3.0.0
47
- name: rspec
48
+ version: '0'
48
49
  type: :development
49
50
  prerelease: false
50
- requirement: !ruby/object:Gem::Requirement
51
+ version_requirements: !ruby/object:Gem::Requirement
51
52
  requirements:
52
- - - "~>"
53
+ - - ">="
53
54
  - !ruby/object:Gem::Version
54
- version: 3.0.0
55
- description: Pure Ruby one-shot and periodic timers
55
+ version: '0'
56
+ description: Schedule procs to run after a certain time, or at periodic intervals,
57
+ using any API that accepts a timeout.
56
58
  email:
57
- - tony.arcieri@gmail.com
59
+ - samuel@codeotaku.com
60
+ - bascule@gmail.com
58
61
  executables: []
59
62
  extensions: []
60
63
  extra_rdoc_files: []
61
64
  files:
62
- - ".coveralls.yml"
63
65
  - ".gitignore"
64
66
  - ".rspec"
65
67
  - ".travis.yml"
66
- - AUTHORS.md
67
- - CHANGES.md
68
68
  - Gemfile
69
- - LICENSE
70
69
  - README.md
71
70
  - Rakefile
72
71
  - lib/timers.rb
73
72
  - lib/timers/events.rb
74
73
  - lib/timers/group.rb
74
+ - lib/timers/interval.rb
75
75
  - lib/timers/timer.rb
76
76
  - lib/timers/version.rb
77
77
  - lib/timers/wait.rb
78
- - spec/cancel_spec.rb
79
- - spec/events_spec.rb
80
- - spec/every_spec.rb
81
- - spec/group_spec.rb
82
- - spec/performance_spec.rb
83
78
  - spec/spec_helper.rb
84
- - spec/strict_spec.rb
85
- - spec/timeout_spec.rb
79
+ - spec/timers/cancel_spec.rb
80
+ - spec/timers/events_spec.rb
81
+ - spec/timers/every_spec.rb
82
+ - spec/timers/group_spec.rb
83
+ - spec/timers/performance_spec.rb
84
+ - spec/timers/strict_spec.rb
85
+ - spec/timers/wait_spec.rb
86
86
  - timers.gemspec
87
- homepage: https://github.com/celluloid/timers
87
+ homepage: https://github.com/socketry/timers
88
88
  licenses:
89
89
  - MIT
90
90
  metadata: {}
@@ -96,7 +96,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
96
  requirements:
97
97
  - - ">="
98
98
  - !ruby/object:Gem::Version
99
- version: '0'
99
+ version: 2.2.1
100
100
  required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - ">="
@@ -104,17 +104,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  version: '0'
105
105
  requirements: []
106
106
  rubyforge_project:
107
- rubygems_version: 2.4.8
107
+ rubygems_version: 2.7.7
108
108
  signing_key:
109
109
  specification_version: 4
110
- summary: Schedule procs to run after a certain time, or at periodic intervals, using
111
- any API that accepts a timeout
110
+ summary: Pure Ruby one-shot and periodic timers
112
111
  test_files:
113
- - spec/cancel_spec.rb
114
- - spec/events_spec.rb
115
- - spec/every_spec.rb
116
- - spec/group_spec.rb
117
- - spec/performance_spec.rb
118
112
  - spec/spec_helper.rb
119
- - spec/strict_spec.rb
120
- - spec/timeout_spec.rb
113
+ - spec/timers/cancel_spec.rb
114
+ - spec/timers/events_spec.rb
115
+ - spec/timers/every_spec.rb
116
+ - spec/timers/group_spec.rb
117
+ - spec/timers/performance_spec.rb
118
+ - spec/timers/strict_spec.rb
119
+ - spec/timers/wait_spec.rb
data/.coveralls.yml DELETED
@@ -1 +0,0 @@
1
- service-name: travis-pro
data/AUTHORS.md DELETED
@@ -1,15 +0,0 @@
1
- # The Celluloid timers gem is beamed directly to you from the minds of...
2
-
3
- - Tony Arcieri <bascule@gmail.com>
4
- - Jeremy Hinegardner
5
- - Sean Gregory
6
- - Chuck Remes
7
- - Utenmiki
8
- - Ron Evans
9
- - Larry Lv
10
- - Bruno Enten
11
- - Jesse Cooke
12
- - Nicholas Evans
13
- - Dimitrij Denissenko
14
- - Ryan LeCompte
15
- - Samuel G. D. Williams
data/CHANGES.md DELETED
@@ -1,54 +0,0 @@
1
- 4.1.1 (2015-08-21)
2
- ------------------
3
- * Remove `RubyProf` from Gemfile and a test, due to it providing no substantial benefit while increasing problems building bundles under Rubinius.
4
-
5
- 4.1.0 (2015-08-16)
6
- ------------------
7
- * Addition of `now_and_every` method; fires block immediately, then sets recurring timer.
8
- * Includes `now_and_after` method; does the same as above for one-shot timers: essentially a "two-shot" timer.
9
-
10
- 4.0.1 (2014-09-10)
11
- ------------------
12
- * Memory leak fixes
13
- * mathn fix for those crazy enough to use it
14
-
15
- 4.0.0 (2014-07-27)
16
- ------------------
17
- * Replace Timers::Timeout with Timers::Wait
18
- * Timers::Group#wait_interval now returns nil when no timers, a postive or
19
- negative interval which if positive is the amount of time required to wait
20
- and if negative, how far in the past the latest timer should have fired
21
- * Performance improvements
22
-
23
- 3.0.1 (2014-06-27)
24
- ------------------
25
- * Require 'set' automatically
26
-
27
- 3.0.0 (2014-06-14)
28
- ------------------
29
- * Refactor `Timers` class into `Timers::Group`
30
- * Add `Timers::Timeout` class for implementing timeouts
31
- * Fix timer fudging
32
- * Update to RSpec 3
33
-
34
- 2.0.0 (2013-12-30)
35
- ------------------
36
- * Switch to Hitimes for high precision monotonic counters
37
- * Removed Timers#time. Replaced with Timers#current_offset which provides a
38
- monotonic time counter.
39
-
40
- 1.1.0
41
- -----
42
- * Timers#after_milliseconds and #after_ms for waiting in milliseconds
43
-
44
- 1.0.2
45
- -----
46
- * Handle overdue timers correctly
47
-
48
- 1.0.1
49
- -----
50
- * Explicitly require Forwardable from stdlib
51
-
52
- 1.0.0
53
- -----
54
- * Initial release
data/LICENSE DELETED
@@ -1,23 +0,0 @@
1
- Copyright (c) 2012-14 The Celluloid Timers Developers: given in the file
2
- AUTHORS.md at https://github.com/celluloid/timers/blob/master/AUTHORS.md
3
-
4
- MIT License
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining
7
- a copy of this software and associated documentation files (the
8
- "Software"), to deal in the Software without restriction, including
9
- without limitation the rights to use, copy, modify, merge, publish,
10
- distribute, sublicense, and/or sell copies of the Software, and to
11
- permit persons to whom the Software is furnished to do so, subject to
12
- the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be
15
- included in all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/spec/cancel_spec.rb DELETED
@@ -1,46 +0,0 @@
1
-
2
- require 'spec_helper'
3
-
4
- RSpec.describe Timers::Group do
5
- it "should be able to cancel twice" do
6
- fired = false
7
-
8
- timer = subject.after(0.1) { fired = true }
9
-
10
- 2.times do
11
- timer.cancel
12
- subject.wait
13
- end
14
-
15
- expect(fired).to be false
16
- end
17
-
18
- it "should be possble to reset after cancel" do
19
- fired = false
20
-
21
- timer = subject.after(0.1) { fired = true }
22
- timer.cancel
23
-
24
- subject.wait
25
-
26
- timer.reset
27
-
28
- subject.wait
29
-
30
- expect(fired).to be true
31
- end
32
-
33
- it "should cancel and remove one shot timers after they fire" do
34
- x = 0
35
-
36
- Timers::Wait.for(2) do |remaining|
37
- timer = subject.every(0.2) { x += 1 }
38
- subject.after(0.1) { timer.cancel }
39
-
40
- subject.wait
41
- end
42
-
43
- expect(subject.timers).to be_empty
44
- expect(x).to be == 0
45
- end
46
- end
data/spec/events_spec.rb DELETED
@@ -1,57 +0,0 @@
1
-
2
- require 'spec_helper'
3
-
4
- RSpec.describe Timers::Events do
5
- it "should register an event" do
6
- fired = false
7
-
8
- callback = proc do |time|
9
- fired = true
10
- end
11
-
12
- subject.schedule(0.1, callback)
13
-
14
- expect(subject.size).to be == 1
15
-
16
- subject.fire(0.15)
17
-
18
- expect(subject.size).to be == 0
19
-
20
- expect(fired).to be true
21
- end
22
-
23
- it "should register events in order" do
24
- fired = []
25
-
26
- times = [0.95, 0.1, 0.3, 0.5, 0.4, 0.2, 0.01, 0.9]
27
-
28
- times.each do |requested_time|
29
- callback = proc do |time|
30
- fired << requested_time
31
- end
32
-
33
- subject.schedule(requested_time, callback)
34
- end
35
-
36
- subject.fire(0.5)
37
- expect(fired).to be == times.sort.first(6)
38
-
39
- subject.fire(1.0)
40
- expect(fired).to be == times.sort
41
- end
42
-
43
- it "should fire events with the time they were fired at" do
44
- fired_at = :not_fired
45
-
46
- callback = proc do |time|
47
- # The time we actually were fired at:
48
- fired_at = time
49
- end
50
-
51
- subject.schedule(0.5, callback)
52
-
53
- subject.fire(1.0)
54
-
55
- expect(fired_at).to be == 1.0
56
- end
57
- end
data/spec/every_spec.rb DELETED
@@ -1,34 +0,0 @@
1
-
2
- require 'spec_helper'
3
-
4
- RSpec.describe Timers::Group do
5
- it "should fire several times" do
6
- result = []
7
-
8
- subject.every(0.7) { result << :a }
9
- subject.every(2.3) { result << :b }
10
- subject.every(1.3) { result << :c }
11
- subject.every(2.4) { result << :d }
12
-
13
- Timers::Wait.for(2.5) do |remaining|
14
- subject.wait if subject.wait_interval < remaining
15
- end
16
-
17
- expect(result).to be == [:a, :c, :a, :a, :b, :d]
18
- end
19
-
20
- it "should fire immediately and then several times later" do
21
- result = []
22
-
23
- subject.every(0.7) { result << :a }
24
- subject.every(2.3) { result << :b }
25
- subject.now_and_every(1.3) { result << :c }
26
- subject.now_and_every(2.4) { result << :d }
27
-
28
- Timers::Wait.for(2.5) do |remaining|
29
- subject.wait if subject.wait_interval < remaining
30
- end
31
-
32
- expect(result).to be == [:c, :d, :a, :c, :a, :a, :b, :d]
33
- end
34
- end