tiny_conveyor 0.0.1 → 0.0.2
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/lib/tiny_conveyor.rb +2 -35
- data/lib/tiny_conveyor/belt.rb +2 -3
- data/tiny_conveyor.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 953527e5871cac63ae9c2ac068d247387aa9ca2a7847947a2b17170419cb51b6
|
4
|
+
data.tar.gz: f7a010aa10771fc6f17259d1a4b234d15df13c8193959f40f9b62c5a0404571a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bab9cde292ab2d4d70a4be91e0e0aab02a429da580190953cce7e2f1c49b39dc3dcac67f4bf5baefd37abadd54b924dd1639cdb998eec781bb4c79b221b3ee75
|
7
|
+
data.tar.gz: fe1c9ceeaa287d9b08fb92b95d66cdc302e372b249d0d638291f0a41885ebffdd51aa2fc7342e2d8c33150a5c000f5a9e42e36fd3be5a419096e120ab296f706
|
data/lib/tiny_conveyor.rb
CHANGED
@@ -5,45 +5,12 @@ require 'tiny_conveyor/parcel'
|
|
5
5
|
|
6
6
|
# main file for Tiny Conveyor gem
|
7
7
|
module TinyConveyor
|
8
|
-
VERSION = '0.0.
|
8
|
+
VERSION = '0.0.2'
|
9
9
|
|
10
10
|
class << self
|
11
11
|
# @return [Belt] newly created belt
|
12
12
|
def new
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
# @param name [string] name of the task
|
17
|
-
# @param description [string] small description of the task
|
18
|
-
# @param action [Proc] action to run in separate thread
|
19
|
-
# @return [Array<Parcel>] pending parcels
|
20
|
-
def add_parcel(name, description, action)
|
21
|
-
belt.add_parcel(name, description, action)
|
22
|
-
end
|
23
|
-
|
24
|
-
# @param uuid [string] uuid of the parcel to remove
|
25
|
-
# @return [Array<Parcel>] pending parcels
|
26
|
-
def remove_parcel(uuid)
|
27
|
-
belt.remove_parcel_by_uuid(uuid)
|
28
|
-
end
|
29
|
-
|
30
|
-
def start_belt
|
31
|
-
belt.start_belt
|
32
|
-
end
|
33
|
-
|
34
|
-
# @return [boolean] true if the belt is running, false otherwhise
|
35
|
-
def running?
|
36
|
-
belt.running?
|
37
|
-
end
|
38
|
-
|
39
|
-
# @return [Array<Parcel>] pending parcels
|
40
|
-
def parcels
|
41
|
-
belt.parcels
|
42
|
-
end
|
43
|
-
|
44
|
-
# @return [Belt]
|
45
|
-
def belt
|
46
|
-
@belt ||= Belt.new
|
13
|
+
Belt.new
|
47
14
|
end
|
48
15
|
end
|
49
16
|
end
|
data/lib/tiny_conveyor/belt.rb
CHANGED
@@ -46,13 +46,13 @@ module TinyConveyor
|
|
46
46
|
@state == :running
|
47
47
|
end
|
48
48
|
|
49
|
-
private
|
50
|
-
|
51
49
|
def remove_parcel(parcel)
|
52
50
|
new_parcels_array = @parcels.reject { |p| p == parcel }
|
53
51
|
@parcels = new_parcels_array
|
54
52
|
end
|
55
53
|
|
54
|
+
private
|
55
|
+
|
56
56
|
def execute
|
57
57
|
return true if running?
|
58
58
|
|
@@ -60,7 +60,6 @@ module TinyConveyor
|
|
60
60
|
@state = :running
|
61
61
|
until tasks.empty?
|
62
62
|
current_parcel = tasks.shift
|
63
|
-
@parcels.first.start
|
64
63
|
current_parcel&.execute
|
65
64
|
@parcels.shift
|
66
65
|
end
|
data/tiny_conveyor.gemspec
CHANGED
@@ -4,7 +4,7 @@ require 'English'
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = 'tiny_conveyor'
|
7
|
-
s.version = '0.0.
|
7
|
+
s.version = '0.0.2'
|
8
8
|
s.required_ruby_version = '>= 2.0.0'
|
9
9
|
s.required_rubygems_version = '>= 1.8.11'
|
10
10
|
s.summary = 'Tiny wrapper aroung concurent ruby to create a queue of tasks'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tiny_conveyor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flo Girardo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|