lib/rapnd.rb in rapnd-0.2.5 vs lib/rapnd.rb in rapnd-0.3.0
- old
+ new
@@ -1,6 +1,22 @@
require 'rapnd/daemon'
require 'rapnd/notification'
+require 'rapnd/config'
+require 'redis'
module Rapnd
+ extend self
+ def queue(queue_name, message)
+ self.redis.lpush(queue_name, Marshal.dump(message))
+ end
+
+ def redis
+ @redis ||= Redis.new(:host => Rapnd.config.redis_host, :port => Rapnd.config.redis_port)
+ end
+
+ def configure
+ block_given? ? yield(Config) : Config
+ end
+ alias :config :configure
+
end
\ No newline at end of file