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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a61335ce0dc5a9aaf5671d1c4628d6de2a4a0cc7
4
- data.tar.gz: 824bb5d6f27b8c9e753ab50ebbefe270ba2c2620
3
+ metadata.gz: 045ba91bf8a82d408506267e6fa07cd9a949e32b
4
+ data.tar.gz: 9d7a437bf51b716ab5bf10af9f0daa7a44e9fa4d
5
5
  SHA512:
6
- metadata.gz: a4ce646a5ad5f0733f9591c07131cb898549c1cdf83cbac7e94c17ee025f8116af5a505fd9450e2e5401d03d1840300151df33c915bf28a2814cc033fa9eb32b
7
- data.tar.gz: 5d0d622c6599299d2341f3b914d0bfdd8bfa615f650fdd9cd82a8e12a8eec5c6c41fd128be76490e96f812d375c82e3b4a419636d036df24287033dbec2abcf5
6
+ metadata.gz: 27603b76837057e75557abccce86da954ef20f1e2ebef19e8e9f1f250185b45883c43637ff47396a53bdd6493a09d3254dd1533c29335d8644b43af05c9aad73
7
+ data.tar.gz: db8943dd8fd7b59a09cde433a7dbd4eb81af1d6d110390b0d0afda2bfe5cc6122d5b10bd46c93f52b9aeb4a26d2af818a77d42929602ad9cb276e77c3e35322c
data/README.md CHANGED
@@ -8,7 +8,7 @@ You need to monitor your threads and kill one specific thread in another part of
8
8
  hm, yeah. just add this to your Gemfile:
9
9
 
10
10
  ```ruby
11
- gem 'thread_watcher', '~> 0.4.0'
11
+ gem 'thread_watcher', '~> 0.5.0'
12
12
  ```
13
13
 
14
14
  And then execute:
@@ -1,5 +1,6 @@
1
1
  require "thread_watcher/version"
2
2
  require "thread_watcher/process_watch"
3
+
3
4
  module ThreadWatcher
4
5
  require 'singleton'
5
6
  class Monitor
@@ -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
- puts "|ID\t\t|Running?\t|Runtime in Seconds\t|"
54
+ ThreadFormatter.headline
57
55
  @threads.each do |key, thread|
58
- puts thread.to_s
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
@@ -1,3 +1,3 @@
1
1
  module ThreadWatcher
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  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.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