Class: BubBot::RedisConnection

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/bub_bot/redis_connection.rb

Overview

Just a simple wrapper around a redis connection. Call .instance on this, then call anything you’d normally call on a Redis on object on this instead. Eg ‘RedisConnection.instance.hgetall(…)`.

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



10
11
12
# File 'lib/bub_bot/redis_connection.rb', line 10

def method_missing(method, *args, &block)
  redis.respond_to?(method) ? redis.public_send(method, *args, &block) : super
end

Instance Method Details

#redisObject



13
14
15
# File 'lib/bub_bot/redis_connection.rb', line 13

def redis
  @redis ||= Redis.new(url: 'redis://' + BubBot.configuration.redis_host)
end