Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

change Marshal serialization to JSON

  • Loading branch information...
commit 3e36d8b7c80e4e32204455a8d0baad41d401e812 1 parent ec21216
@smoku smoku authored
Showing with 3 additions and 3 deletions.
  1. +1 −1  lib/rapnd.rb
  2. +1 −1  lib/rapnd/daemon.rb
  3. +1 −1  spec/rapnd_spec.rb
View
2  lib/rapnd.rb
@@ -7,7 +7,7 @@ module Rapnd
extend self
def queue(queue_name, message)
- self.redis.lpush(queue_name, Marshal.dump(message))
+ self.redis.lpush(queue_name, message.to_json)
end
def redis
View
2  lib/rapnd/daemon.rb
@@ -54,7 +54,7 @@ def run!
begin
message = @redis.blpop(self.queue, 1)
if message
- notification = Rapnd::Notification.new(Marshal.load(message.last))
+ notification = Rapnd::Notification.new(JSON(message.last).symbolize_keys)
self.connect! unless self.connected
@logger.info "Sending #{notification.device_token}: #{notification.json_payload}"
self.apple.write(notification.to_bytes)
View
2  spec/rapnd_spec.rb
@@ -14,7 +14,7 @@
Rapnd.queue('test_queue', {:alert => 'Hi!'})
@redis.llen('test_queue').should == 1
- Marshal.load(@redis.lpop('test_queue')).should == {:alert => 'Hi!'}
+ JSON(@redis.lpop('test_queue')).symbolize_keys.should == {:alert => 'Hi!'}
end
it 'gets a redis connection' do
Please sign in to comment.
Something went wrong with that request. Please try again.