roundrobin 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -10
- data/lib/roundrobin/version.rb +1 -1
- data/roundrobin.gemspec +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 251df981a6e399b20794cdcf1e3a287ee1064239
|
4
|
+
data.tar.gz: 1c751da8cdaeecd33f6b9f51eaa273fb57e78b16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1e0fd6447bcc0b75ed8981fa4ea76a0bf9632ae55f2b28528c7c18d592cf64e383b62e4ad933e26ccaeb6f7637b39c313f04e9a2d92d82ca9fc53e34224b904
|
7
|
+
data.tar.gz: fa48c36121ba061204c2fb1855609fe04b524f1121254bccade774d066c52ae218c5e32f52f2c156695ca78646d611fcef6fd1af88d446416c096b6d691b75ad
|
data/README.md
CHANGED
@@ -6,34 +6,47 @@ Add a Round-Robin based process to your flow.
|
|
6
6
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
|
-
```
|
9
|
+
```rb
|
10
10
|
gem 'roundrobin'
|
11
11
|
```
|
12
12
|
|
13
13
|
And then execute:
|
14
14
|
|
15
|
-
|
15
|
+
```
|
16
|
+
$ bundle
|
17
|
+
```
|
16
18
|
|
17
19
|
Or install it yourself as:
|
18
20
|
|
19
|
-
|
21
|
+
```
|
22
|
+
$ gem install roundrobin
|
23
|
+
```
|
20
24
|
|
21
25
|
## Usage
|
22
26
|
|
27
|
+
Initialize your Round-Robin instance
|
23
28
|
```rb
|
24
|
-
>> Roundrobin.
|
29
|
+
>> rr = Roundrobin.new
|
30
|
+
```
|
31
|
+
or
|
32
|
+
```rb
|
33
|
+
>> rr = Roundrobin.new("redis://:p4ssw0rd@10.0.1.1:6380/15")
|
34
|
+
```
|
35
|
+
Now you can ask for the next item (in a Round-Robin logic)
|
36
|
+
```rb
|
37
|
+
>> rr.next(%w(foo bar))
|
25
38
|
=> "foo"
|
26
|
-
>>
|
39
|
+
>> rr.next(%w(foo bar))
|
27
40
|
=> "bar"
|
28
|
-
>>
|
41
|
+
>> rr.next(%w(foo bar))
|
29
42
|
=> "foo"
|
30
43
|
|
31
44
|
>> candidates = [{name: 'John', email: 'john@example.com'}, {name: 'Sara', email: 'sara@example.com'}])
|
32
|
-
>>
|
45
|
+
>> rr.next(candidates)
|
33
46
|
=> {name: 'John', email: 'john@example.com'}
|
34
|
-
>>
|
47
|
+
>> rr.next(candidates)
|
35
48
|
=> {name: 'Sara', email: 'sara@example.com'}
|
36
|
-
>>
|
49
|
+
>> rr.next(candidates)
|
37
50
|
=> {name: 'John', email: 'john@example.com'}
|
38
51
|
```
|
39
52
|
|
@@ -41,13 +54,15 @@ All the data will be persisted to your DB, so you can restart your server, or do
|
|
41
54
|
|
42
55
|
## Development
|
43
56
|
|
57
|
+
```
|
44
58
|
$ cd roundrobin
|
45
59
|
$ gem build roundrobin.gemspec
|
46
60
|
$ gem install ./roundrobin-XXX.gem
|
61
|
+
```
|
47
62
|
|
48
63
|
## Contributing
|
49
64
|
|
50
|
-
1. Fork it ( https://github.com/
|
65
|
+
1. Fork it ( https://github.com/archdaily/roundrobin/fork )
|
51
66
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
52
67
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
53
68
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/roundrobin/version.rb
CHANGED
data/roundrobin.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Gustavo Garcia", "Sergio Márquez"]
|
10
10
|
spec.email = ["dev@archdaily.com"]
|
11
11
|
spec.summary = "Iterates over an array with a persisted Round-Robin algorithm"
|
12
|
-
spec.description = "
|
13
|
-
spec.homepage = "http://github.com/
|
12
|
+
spec.description = "Just ask for the next item of a specified array. It will be persisted to a Redis DB"
|
13
|
+
spec.homepage = "http://github.com/archdaily/roundrobin"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roundrobin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gustavo Garcia
|
@@ -81,7 +81,8 @@ dependencies:
|
|
81
81
|
- - '>='
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
|
-
description:
|
84
|
+
description: Just ask for the next item of a specified array. It will be persisted
|
85
|
+
to a Redis DB
|
85
86
|
email:
|
86
87
|
- dev@archdaily.com
|
87
88
|
executables: []
|
@@ -99,7 +100,7 @@ files:
|
|
99
100
|
- roundrobin.gemspec
|
100
101
|
- spec/roundrobin_spec.rb
|
101
102
|
- spec/spec_helper.rb
|
102
|
-
homepage: http://github.com/
|
103
|
+
homepage: http://github.com/archdaily/roundrobin
|
103
104
|
licenses:
|
104
105
|
- MIT
|
105
106
|
metadata: {}
|