coordinator 0.0.5 → 0.0.6

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: f66708844197caa57e7e913f69c715efcb652dc9
4
- data.tar.gz: d5cd8fed2ad8715ab68ea8acaede0b21c72f81d2
3
+ metadata.gz: 71eb76d378d1147cdbfd7e78d875f32f9d83565b
4
+ data.tar.gz: 6f6be3352fe457ebf328eb57f207a1cf41a677e3
5
5
  SHA512:
6
- metadata.gz: 0da397ca8c9462beb8b3ab3beb8ecd1e7864ca72a671e8f883c136fc74e54e6823eb19f9bca3b62b582064a42ddd2b1079abf704ed777a22617699e1a6f857fd
7
- data.tar.gz: bd1ec9dd92c33e236ab1ba51215782485ab8f6772a6f31d0992398a456745d567f57311c7f5e8e4098861a6390a60b4c1c3281f130d58c5529fb0f9b8f46afc8
6
+ metadata.gz: 88bbe072e9a127f64c29b60fa2c48f13dafa2b7c4f15fee453344edf3c9af75e7a12243995ea48c4d63fb652123da1e7497d21a53e9741cc2f682b2886c91daa
7
+ data.tar.gz: 69fe1fa61e8640205c213bf6b91a8e768007d148352441a77ac071a167b95909c6fdaa201deccf2cdd6bddc8b15496eb65f0e068d5bf82bbc25c41a3e40e4e32
@@ -31,10 +31,10 @@ module Coordinator
31
31
  def info(skill)
32
32
  queue = queue_for_skill(skill)
33
33
  {
34
- :name => queue.name,
35
- :capacity => queue.capacity,
36
- :count => queue.length,
37
- :items => queue.items
34
+ "name" => queue.name,
35
+ "capacity" => queue.capacity,
36
+ "count" => queue.length,
37
+ "items" => queue.items
38
38
  }
39
39
  end
40
40
 
@@ -22,7 +22,7 @@ module Coordinator
22
22
 
23
23
  def pop
24
24
  data = @redis.lpop(@queue_name)
25
- parse(data)
25
+ deserialize(data)
26
26
  end
27
27
 
28
28
  def remove(item)
@@ -32,7 +32,7 @@ module Coordinator
32
32
 
33
33
  def peek
34
34
  data = @redis.lrange(@queue_name, 0, 0).first
35
- parse(data)
35
+ deserialize(data)
36
36
  end
37
37
 
38
38
  def length
@@ -41,7 +41,7 @@ module Coordinator
41
41
 
42
42
  def capacity
43
43
  data = @redis.get(@capacity_name)
44
- parse(data)
44
+ deserialize(data)
45
45
  end
46
46
 
47
47
  def capacity=(capacity)
@@ -49,7 +49,7 @@ module Coordinator
49
49
  end
50
50
 
51
51
  def items
52
- @redis.lrange(@queue_name, 0, length)
52
+ @redis.lrange(@queue_name, 0, length).map { |i| deserialize(i) }
53
53
  end
54
54
 
55
55
  private
@@ -62,7 +62,7 @@ module Coordinator
62
62
  item.is_a?(String) ? item : item.to_json
63
63
  end
64
64
 
65
- def parse(item)
65
+ def deserialize(item)
66
66
  return item if item.nil?
67
67
  return item.to_i if item.to_i.to_s == item
68
68
  begin
@@ -1,3 +1,3 @@
1
1
  module Coordinator
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -13,8 +13,8 @@ describe 'ParallelismTest' do
13
13
 
14
14
  it 'works syncronously' do
15
15
  125.times { perform_work }
16
- assert_equal [], @coordinator.info("tasks")[:items]
17
- array_equal(@tasks, @coordinator.info("completed_tasks")[:items])
16
+ assert_equal [], @coordinator.info("tasks")["items"]
17
+ array_equal(@tasks, @coordinator.info("completed_tasks")["items"])
18
18
  end
19
19
 
20
20
  it 'works in parallel' do
@@ -30,8 +30,8 @@ describe 'ParallelismTest' do
30
30
  end
31
31
  workers.each { |w| w.join }
32
32
 
33
- assert_equal [], @coordinator.info("tasks")[:items]
34
- array_equal(@tasks, @coordinator.info("completed_tasks")[:items])
33
+ assert_equal [], @coordinator.info("tasks")["items"]
34
+ array_equal(@tasks, @coordinator.info("completed_tasks")["items"])
35
35
  end
36
36
 
37
37
  def perform_work(i=nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coordinator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Mercier