eventmachine-redis 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{eventmachine-redis}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tristan Dunn"]
@@ -9,7 +9,7 @@ module EventMachine::Protocols::Redis
9
9
  TYPE_INTEGER = ':'.freeze
10
10
  TYPE_MULTIPLE = '*'.freeze
11
11
 
12
- MULTILINE_COMMANDS = %w().freeze
12
+ MULTILINE_COMMANDS = %w(RPUSH).freeze
13
13
 
14
14
  def self.connect(host = 'localhost', port = 6379)
15
15
  EM.connect(host, port, self)
@@ -41,6 +41,10 @@ module EventMachine::Protocols::Redis
41
41
  end
42
42
  end
43
43
 
44
+ def push(key, value, &block)
45
+ command('RPUSH', key, value, &block)
46
+ end
47
+
44
48
  def shift(key, options = {}, &block)
45
49
  if options[:timeout]
46
50
  command('BLPOP', key, options[:timeout], &block)
data/spec/redis_spec.rb CHANGED
@@ -25,7 +25,7 @@ describe EventMachine::Protocols::Redis do
25
25
  end
26
26
 
27
27
  it 'should define multiline commands constant' do
28
- Redis::MULTILINE_COMMANDS.should == %w()
28
+ Redis::MULTILINE_COMMANDS.should == %w(RPUSH)
29
29
  end
30
30
 
31
31
  it 'should connect via EventMachine when calling Redis.connect' do
@@ -88,6 +88,13 @@ describe EventMachine::Protocols::Redis do
88
88
  @completed.should be_true
89
89
  end
90
90
 
91
+ describe '#push' do
92
+ it 'should generate RPUSH command' do
93
+ @instance.push('key', 'value')
94
+ @instance.sent_data.should == "RPUSH key 5\r\nvalue\r\n"
95
+ end
96
+ end
97
+
91
98
  describe '#shift' do
92
99
  it 'should generate LPOP command' do
93
100
  @instance.shift('key')
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Tristan Dunn