ppool 1.2.0 → 1.2.1

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/process_pool_util.rb +66 -0
  3. metadata +2 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a26e4d31307303960169d895e99c920b2973274
4
- data.tar.gz: ff136111314394c13522c6af72074f935d50cb4b
3
+ metadata.gz: 3c718040d878fe6f97991fcaa3581a82354139f1
4
+ data.tar.gz: 4428b33b25d62ab0fbdf2a10251b367351055b9c
5
5
  SHA512:
6
- metadata.gz: 731c02140ced9acf4124d9322d3eeee11df2ae7a3b3d9b0cbd39b4760f09c2a1b9784e854a6cb795fb273484d394828fa50da9fdc656433a8a3eeff8647b6356
7
- data.tar.gz: 22ef5674086659c33e6738b9c384b258e9fd29edd9632d9b078f79b52a6ff1c2c045de4f4b72980786d900afd6d9091c9ee0b6df5107ab846b1964648dc721d0
6
+ metadata.gz: 3ab15801da62b7b9f276f3f03924d6059de8a480ef040f4843ebdb2acc8d495e9a893dc3ba2490576d6365ccb7aeb2e40a717d474f8d97fd95d3085eddd773ff
7
+ data.tar.gz: 2d1793f63a764c445d8035ba9d381e2d1df0d8df172c5422bffb58c9aa101959451e9efbf491da62d72d69d2518fdcbbd35b6eacc1c2f18f0a1911fc997c1105
@@ -0,0 +1,66 @@
1
+ #
2
+ # MIT License
3
+ #
4
+ # Copyright (c) 2016 Paul Taylor
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ # of this software and associated documentation files (the "Software"), to deal
8
+ # in the Software without restriction, including without limitation the rights
9
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ # copies of the Software, and to permit persons to whom the Software is
11
+ # furnished to do so, subject to the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included in all
14
+ # copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ # SOFTWARE.
23
+ #
24
+
25
+ module PPool
26
+ extend self
27
+
28
+
29
+ def convert_time_to_secs(timespec)
30
+
31
+ s = 0
32
+ m = 0
33
+ h = 0
34
+
35
+ parts = timespec.split(':')
36
+ case parts.length
37
+ when 1
38
+ s = parts[0].to_i
39
+ when 2
40
+ s = parts[1].to_i
41
+ m = parts[0].to_i
42
+ when 3
43
+ s = parts[2].to_i
44
+ m = parts[1].to_i
45
+ h = parts[0].to_i
46
+
47
+ else
48
+ raise ArgumentError.new('invalid timespec; too many parts')
49
+ end
50
+
51
+ if s < 0 || s > 59
52
+ raise ArgumentError.new('invalid timespec; seconds are invalid')
53
+ end
54
+
55
+ if m < 0 || m > 59
56
+ raise ArgumentError.new('invalid timespec; minutes are invalid')
57
+ end
58
+ if h < 0 || h > 24
59
+ raise ArgumentError.new('invalid timespec; hours are invalid')
60
+ end
61
+
62
+ return h * (60 * 60) + m * 60 + s
63
+
64
+ end
65
+
66
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ppool
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Taylor
@@ -79,6 +79,7 @@ files:
79
79
  - lib/curses_process_controller.rb
80
80
  - lib/ppool.rb
81
81
  - lib/process_pool.rb
82
+ - lib/process_pool_util.rb
82
83
  - lib/shell_process_controller.rb
83
84
  - lib/terminal_process_controller.rb
84
85
  - lib/timed_process_controller.rb