thread_watcher 0.4.0 → 0.5.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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/thread_watcher.rb +1 -0
- data/lib/thread_watcher/process_watch.rb +4 -6
- data/lib/thread_watcher/thread_formatter.rb +15 -0
- data/lib/thread_watcher/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 045ba91bf8a82d408506267e6fa07cd9a949e32b
|
4
|
+
data.tar.gz: 9d7a437bf51b716ab5bf10af9f0daa7a44e9fa4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27603b76837057e75557abccce86da954ef20f1e2ebef19e8e9f1f250185b45883c43637ff47396a53bdd6493a09d3254dd1533c29335d8644b43af05c9aad73
|
7
|
+
data.tar.gz: db8943dd8fd7b59a09cde433a7dbd4eb81af1d6d110390b0d0afda2bfe5cc6122d5b10bd46c93f52b9aeb4a26d2af818a77d42929602ad9cb276e77c3e35322c
|
data/README.md
CHANGED
data/lib/thread_watcher.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "thread_watcher/thread_formatter"
|
2
|
+
|
1
3
|
module ThreadWatcher
|
2
4
|
class ProcessWatch
|
3
5
|
attr_accessor :threads
|
@@ -16,10 +18,6 @@ module ThreadWatcher
|
|
16
18
|
@thread.alive?
|
17
19
|
end
|
18
20
|
|
19
|
-
def to_s
|
20
|
-
"|#{id}\t|#{alive?}\t\t|\t#{runtime}\t\t|"
|
21
|
-
end
|
22
|
-
|
23
21
|
def runtime
|
24
22
|
time_to_i - @id
|
25
23
|
end
|
@@ -53,9 +51,9 @@ module ThreadWatcher
|
|
53
51
|
end
|
54
52
|
|
55
53
|
def status
|
56
|
-
|
54
|
+
ThreadFormatter.headline
|
57
55
|
@threads.each do |key, thread|
|
58
|
-
|
56
|
+
ThreadFormatter.data thread
|
59
57
|
end
|
60
58
|
''
|
61
59
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ThreadWatcher
|
2
|
+
class ThreadFormatter
|
3
|
+
def self.headline
|
4
|
+
self.output "|ID\t\t|Running?\t|Runtime in Seconds\t|"
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.data thread
|
8
|
+
self.output "|#{thread.id}\t|#{thread.alive?}\t\t|\t#{thread.runtime}\t\t|"
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.output content
|
12
|
+
puts content
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thread_watcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Starke
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- bin/setup
|
60
60
|
- lib/thread_watcher.rb
|
61
61
|
- lib/thread_watcher/process_watch.rb
|
62
|
+
- lib/thread_watcher/thread_formatter.rb
|
62
63
|
- lib/thread_watcher/version.rb
|
63
64
|
- thread_watcher.gemspec
|
64
65
|
homepage: https://github.com/robst/thread_watcher
|