turnpike 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5cc33fb8535559daf70d3901bc2099644bc291b6
4
- data.tar.gz: 0a3fd6e3d12dfbbdbf450252eee59b6e31c2c1a9
3
+ metadata.gz: 8bdc1b9661a68b1c18fca240429d6181bdc7ff33
4
+ data.tar.gz: df17c9caad3616a26d0b5958640271a312f0f859
5
5
  SHA512:
6
- metadata.gz: 0ea35fe014cf3829a24677a7ab481e58b399355c04661581c2e300c0bc31edf877cf7f6c093df2f0a98ccfeb08477c2d21eee95d907df8151a12be24595fe1ac
7
- data.tar.gz: 8a46a54abc67b7ea943f66425d46ccd6825db44e46f4a18fc7b20aa11453b837b3c2704ac17f91e4bdf1fbc1279134dbddbc9d1fa0ec2e6e5e05dbf4624e12c4
6
+ metadata.gz: 01885b3d7c7d721a652eeada839005a9f4a65e4fd79a4061205ec5786648f15ae4d57a23dcd5da8110af825e5530bc8927311e2205c18cb791af6bb3bb729d69
7
+ data.tar.gz: 9c05aa377660cc4a2e5da456b149f34f9ffde0666cf7e52cbf13aae0dd096633c2b21a28ea2cf5267481ee2624008ae33e0fc8243537d3e00841873c125c815d
@@ -23,11 +23,11 @@ module Turnpike
23
23
  size == 0
24
24
  end
25
25
 
26
- Pops one or more items from the front of the queue.
26
+ Pop one or more items from the front of the queue.
27
27
  #
28
28
  # n - Integer number of items to pop.
29
29
  #
30
- # Return a String item, an Array of items, or nil if the queue is empty.
30
+ # Returns a String item, an Array of items, or nil if the queue is empty.
31
31
  def pop(n = 1)
32
32
  items = []
33
33
  n.times do
@@ -67,7 +67,7 @@ module Turnpike
67
67
  private
68
68
 
69
69
  def redis
70
- Redis.current ||= Redis.connect(Turnpike.options)
70
+ Redis.current
71
71
  end
72
72
  end
73
73
  end
@@ -1,3 +1,3 @@
1
1
  module Turnpike
2
- VERSION = '0.4.1'
2
+ VERSION = '0.5.0'
3
3
  end
data/lib/turnpike.rb CHANGED
@@ -3,26 +3,10 @@ require 'turnpike/queue'
3
3
 
4
4
  # A Redis-backed queue.
5
5
  module Turnpike
6
- class << self
7
- # Returns a Queue.
8
- #
9
- # name - A queue name that responds to to_s.
10
- def [](name)
11
- Queue.new name
12
- end
13
-
14
- # Set Redis connection options.
15
- #
16
- # hsh - A Hash of options.
17
- #
18
- # Returns nothing.
19
- def connect(hsh)
20
- @options = hsh
21
- end
22
-
23
- # Internal: Returns a Hash of Redis connection options.
24
- def options
25
- @options ||= {}
26
- end
6
+ # Returns a Queue.
7
+ #
8
+ # name - A queue name that responds to to_s.
9
+ def self.[](name)
10
+ Queue.new(name)
27
11
  end
28
12
  end
@@ -36,14 +36,6 @@ class TestTurnpike < MiniTest::Unit::TestCase
36
36
  assert_equal [1, 2, 3], peek(queue)
37
37
  end
38
38
 
39
- def test_push_2_2
40
- queue = Turnpike::Queue.new
41
- queue.instance_variable_set :@redis_version, '2.2'
42
- queue.push(1)
43
- queue.push(2, 3)
44
- assert_equal [1, 2, 3], peek(queue)
45
- end
46
-
47
39
  def test_unshift
48
40
  queue = Turnpike::Queue.new
49
41
  queue.unshift(1)
@@ -53,14 +45,6 @@ class TestTurnpike < MiniTest::Unit::TestCase
53
45
  assert_equal [3, 2, 1], peek(queue)
54
46
  end
55
47
 
56
- def test_unshift_2_2
57
- queue = Turnpike::Queue.new
58
- queue.instance_variable_set :@redis_version, '2.2'
59
- queue.unshift(1)
60
- queue.unshift(2, 3)
61
- assert_equal [3, 2, 1], peek(queue)
62
- end
63
-
64
48
  def test_pop
65
49
  queue = Turnpike::Queue.new
66
50
  queue.push(1, 2)
@@ -94,11 +78,4 @@ class TestTurnpike < MiniTest::Unit::TestCase
94
78
  assert_equal 1, queue1.size
95
79
  assert_equal 2, queue2.size
96
80
  end
97
-
98
- def test_peek
99
- queue = Turnpike::Queue.new
100
- assert_equal [], peek(queue)
101
- queue << 1
102
- assert_equal [1], peek(queue)
103
- end
104
81
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turnpike
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hakan Ensari
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-28 00:00:00.000000000 Z
11
+ date: 2013-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis