Module: RMessage
- Defined in:
- lib/rmessage.rb,
lib/rmessage/message.rb
Overview
Utility modules to make it easier to build Pub/Sub systems in Ruby using Redis.
Defined Under Namespace
Modules: Publisher, Subscriber Classes: Message
Constant Summary collapse
- CONNECTION_POOL =
Returns a pool of connections.
[]
Instance Attribute Summary collapse
-
#CONNECTION_POOL ⇒ Array
readonly
A pool of connections.
Class Method Summary collapse
Instance Attribute Details
#CONNECTION_POOL ⇒ Array (readonly)
Returns a pool of connections.
14 |
# File 'lib/rmessage.rb', line 14 CONNECTION_POOL = [] |
Class Method Details
.add_connection(opts = {}) ⇒ Object
21 22 23 |
# File 'lib/rmessage.rb', line 21 def self.add_connection(opts = {}) CONNECTION_POOL << Redis.new(host: opts[:host], port: opts[:port]) end |
.load_defaults ⇒ Object
25 26 27 28 29 30 |
# File 'lib/rmessage.rb', line 25 def self.load_defaults # Load ENV vars. Dotenv.load('.env') if File.exist?('.env') Oj. = { mode: :object, cache_keys: true, cache_strings: true, symbol_keys: false } RMessage.add_connection(host: ENV['RMESSAGE_REDIS_HOST'], port: ENV['RMESSAGE_REDIS_PORT']) end |