lib/bot/context.rb in bot-0.0.33 vs lib/bot/context.rb in bot-0.0.34

- old
+ new

@@ -16,26 +16,26 @@ self.get(m) end end def get(field) - data = $redis.hget(context_key, field) + data = redis_client.hget(context_key, field) JSON.parse(data) if data.present? rescue JSON::ParserError data end def set(context) self.clear - $redis.hmset(context_key, context.map { |k, v| [k, v] }.flatten) + redis_client.hmset(context_key, context.map { |k, v| [k, v] }.flatten) end def add(field, content) - $redis.hset context_key, field, content + redis_client.hset context_key, field, content end def clear - $redis.del context_key + redis_client.del context_key end def context_key "bot:context:#{user.id}" end