rector 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,16 +14,16 @@ module Rector
14
14
 
15
15
  def update_job_data_from_hash(hsh)
16
16
  redis.multi do
17
- redis.sadd(KEY_LIST_SET, hsh.keys)
17
+ hsh.keys.each { |k| redis.sadd(KEY_LIST_SET, k) }
18
18
 
19
19
  hsh.each do |key, val|
20
20
  case val
21
21
  when Numeric
22
22
  redis.incrby(key, val)
23
23
  when Set
24
- redis.sadd(key, val.to_a)
24
+ val.each { |v| redis.sadd(key, v) }
25
25
  when Enumerable
26
- redis.rpush(key, val)
26
+ val.each { |v| redis.rpush(key, v) }
27
27
  end
28
28
  end
29
29
  end
data/rector.gemspec CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "rector"
6
- s.version = "0.0.2"
6
+ s.version = "0.0.3"
7
7
  s.authors = ["Andy Lindeman"]
8
8
  s.email = ["alindeman@gmail.com"]
9
9
  s.homepage = "https://github.com/alindeman/rector"
@@ -23,7 +23,8 @@ describe Rector::Backends::Redis do
23
23
  "bar" => 2
24
24
  }
25
25
 
26
- redis.expects(:sadd).with("#{job_id}:__keys__", ["foo", "bar"])
26
+ redis.expects(:sadd).with("#{job_id}:__keys__", "foo")
27
+ redis.expects(:sadd).with("#{job_id}:__keys__", "bar")
27
28
  subject.update_job_data_from_hash(hsh)
28
29
  end
29
30
 
@@ -37,14 +38,18 @@ describe Rector::Backends::Redis do
37
38
  it "stores lists" do
38
39
  hsh = { "foo" => ["a", "b", "c"] }
39
40
 
40
- redis.expects(:rpush).with("#{job_id}:foo", ["a", "b", "c"])
41
+ redis.expects(:rpush).with("#{job_id}:foo", "a")
42
+ redis.expects(:rpush).with("#{job_id}:foo", "b")
43
+ redis.expects(:rpush).with("#{job_id}:foo", "c")
41
44
  subject.update_job_data_from_hash(hsh)
42
45
  end
43
46
 
44
47
  it "stores sets" do
45
48
  hsh = { "foo" => Set.new(["a", "b", "c"]) }
46
49
 
47
- redis.expects(:sadd).with("#{job_id}:foo", ["a", "b", "c"])
50
+ redis.expects(:sadd).with("#{job_id}:foo", "a")
51
+ redis.expects(:sadd).with("#{job_id}:foo", "b")
52
+ redis.expects(:sadd).with("#{job_id}:foo", "c")
48
53
  subject.update_job_data_from_hash(hsh)
49
54
  end
50
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis
16
- requirement: &70159131664760 !ruby/object:Gem::Requirement
16
+ requirement: &70276889123660 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70159131664760
24
+ version_requirements: *70276889123660
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: redis-namespace
27
- requirement: &70159131664320 !ruby/object:Gem::Requirement
27
+ requirement: &70276893259020 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70159131664320
35
+ version_requirements: *70276893259020
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &70159131663900 !ruby/object:Gem::Requirement
38
+ requirement: &70276893284280 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70159131663900
46
+ version_requirements: *70276893284280
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &70159131663400 !ruby/object:Gem::Requirement
49
+ requirement: &70276893134980 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 2.8.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70159131663400
57
+ version_requirements: *70276893134980
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: mocha
60
- requirement: &70159131662900 !ruby/object:Gem::Requirement
60
+ requirement: &70276893368880 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: 0.10.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70159131662900
68
+ version_requirements: *70276893368880
69
69
  description: ! " Rector allows coordination of a number of jobs spawned with a
70
70
  mechanism\n like Resque (though any job manager will do). If you are able to
71
71
  parallelize\n the processing of a task, yet all these tasks are generating metrics,\n
@@ -108,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
108
  version: '0'
109
109
  segments:
110
110
  - 0
111
- hash: 3768729583706466489
111
+ hash: 473261746240186499
112
112
  required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  none: false
114
114
  requirements:
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  version: '0'
118
118
  segments:
119
119
  - 0
120
- hash: 3768729583706466489
120
+ hash: 473261746240186499
121
121
  requirements: []
122
122
  rubyforge_project:
123
123
  rubygems_version: 1.8.14