wires 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/wires/hub.rb +20 -22
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb97d55c948913573e2401e46550542dae250305
4
- data.tar.gz: d98c4ada2a9c71859afb47be0ede706b37beafc1
3
+ metadata.gz: 40c67db203689c9ec0f32d844252da5fd125d0b6
4
+ data.tar.gz: 9d27b886a47150a99e68d1e10f7d0e9cc4550b31
5
5
  SHA512:
6
- metadata.gz: ece77fc145f4c03da156da35159b53f512690879074f4a291e43739d846933ad65511d2b56b89687462bafd9d7c4292ba34b33cc21acdd12d9081839a7e2bc4d
7
- data.tar.gz: 57a1a47f9907b9e6d7ce4688ea15f2f9a863333baed10b9d686cc17bd143673a875fd3efcaf19e1e7e95a23f4919fa9df511243a9ec8b13e7c30fcc9563bf8f2
6
+ metadata.gz: a3d64df40e1a6ae3e73a8534a9a2955df9462eae21ba54119ff4b9be1ba775fc1b490497b824c3030f75d32356fd05592f1cb86d4143c7a2492a672b4480d37e
7
+ data.tar.gz: b801be4fd8e4ad7d6d90a45575c5b865e052a3d11de7267db4f5c4fac3ea482b5e8e22b35e6db87bad5811eba6e3af2ff9ef564c802195a5a5e38f42648ebd74
data/lib/wires/hub.rb CHANGED
@@ -6,30 +6,28 @@ module Wires
6
6
  # An Event Hub. Event/proc associations come in, and the procs
7
7
  # get called in new threads in the order received
8
8
  class Hub
9
-
10
- @queue = Queue.new
11
-
12
- @child_threads = Array.new
13
- @child_threads_lock = Mutex.new
14
-
15
- @before_kills = Queue.new
16
- @after_kills = Queue.new
17
-
18
- @please_finish_all = false
19
- @please_kill = false
20
-
21
9
  # Operate on the metaclass as a type of singleton pattern
22
10
  class << self
23
11
 
24
- # Clone all clonable instance variables as well
25
- def clone_deeper
26
- result = clone
27
- self.instance_variables.each do |sym|
28
- begin varcopy = instance_variable_get(sym).clone
29
- rescue TypeError; end
30
- result.instance_variable_set(sym, varcopy)
31
- end
32
- result
12
+ # Moved to a dedicated method for subclass' sake
13
+ def class_init
14
+ @queue = Queue.new
15
+
16
+ @child_threads = Array.new
17
+ @child_threads_lock = Mutex.new
18
+
19
+ @before_kills = Queue.new
20
+ @after_kills = Queue.new
21
+
22
+ @please_finish_all = false
23
+ @please_kill = false
24
+
25
+ state_machine_init
26
+ nil end
27
+
28
+ # Make subclasses call class_init
29
+ def inherited(subcls)
30
+ subcls.class_init
33
31
  end
34
32
 
35
33
  def dead?; state==:dead end
@@ -212,7 +210,7 @@ module Wires
212
210
 
213
211
  end
214
212
  end
215
- state_machine_init
216
213
 
214
+ class_init
217
215
  end
218
216
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wires
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe McIlvain