rdispatch 0.0.1a → 0.0.1b

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/rdispatch.rb +5 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a123381331847cab84773b4aa4235285b0defd72
4
- data.tar.gz: 0a2a9eb7d269f92aa124306ab8aca0a7c6a2e845
3
+ metadata.gz: 924f0a84c2230e40ec2781e5b4249940938aad58
4
+ data.tar.gz: e00ca32942ea868210c2cf83a688deb2acd7de5f
5
5
  SHA512:
6
- metadata.gz: 269d2c59052fbdf1b72e6bde584942c2f9e589886416942480f7d670d7a5a069d73bbf10f28b49cbdb1e72e8d51c8147e3d6822b2f38aeaabdb78c4629728d9b
7
- data.tar.gz: 67cdd1052f0384206598e21054ca8fd59f5b87989d3b530710795c37e70527d3e53ebc1f0a559a0c163c94053ccf93c14c9a8d759b93edb083457d3344993905
6
+ metadata.gz: 7a7a56c01f3df4823defa205c4d729ce4689fc84be1cf7c1c3579d62cb294095ce2c97388bf77211b238b16594dd64178d9a64728e1c10f221265ac4c8a5e49e
7
+ data.tar.gz: 75de049ea2035917c45878c4d280644dc534977e88fe9dccfbae00a8ee950a32a3407b347ec00997cd958ab847aba387921cf0bdb2d78699f888822e2930115d
data/lib/rdispatch.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  class RDispatch
2
2
 
3
3
  def initialize
4
- tasks = []
4
+ @tasks = []
5
5
  end
6
6
 
7
7
  def create_task(callback, data)
@@ -12,24 +12,24 @@ class RDispatch
12
12
  split_data = data.each_slice((data.size/avail_threads.to_f).round).to_a
13
13
  split_data.each do |data_array|
14
14
  # create tasks, each with 1/n of data, where n is number of cpu cores
15
- tasks << proc { callback.call(data_array) }
15
+ @tasks << proc { callback.call(data_array) }
16
16
  end
17
17
  end
18
18
 
19
19
  def run!
20
20
  # run tasks, each in its own thread
21
21
  threads = []
22
- tasks.each do |t|
22
+ @tasks.each do |t|
23
23
  threads << Thread.new do
24
24
  puts "spawning thread"
25
25
  t.call
26
26
  end
27
27
  end
28
28
  threads.each(&:join)
29
- tasks = []
29
+ @tasks = []
30
30
  end
31
31
 
32
32
  private
33
- tasks = []
33
+ @tasks = []
34
34
  end
35
35
  require 'rdispatch/sys'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdispatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1a
4
+ version: 0.0.1b
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valeriy Antonov