agoragames / leaderboard

Leaderboards backed by Redis in Ruby
https://rubygems.org/gems/leaderboard
MIT License
480 stars 65 forks source link

expose the redis_connection as an r/w attribute #20

Closed hypomodern closed 12 years ago

hypomodern commented 12 years ago

also my editor hates trailing whitespace. The only substantive change is declaring attr_accessor :redis_connection so you can swap out the redis connection at will.

czarneckid commented 12 years ago

You can pass in an existing connection to Redis using :redis_connection in the Redis options hash. Do you need to swap out the Redis connection afterwards?

hypomodern commented 12 years ago

Yes. I am generating leaderboard objects via a factory method; I suppose I could make the default options that the factory uses injectable, which would work too. If you're opposed to exposing it here for some reason :).

czarneckid commented 12 years ago

It just seems weird to swap the connection after the fact since then you're in the situation where you've got 2 connections to Redis when I think you only really want one.

czarneckid commented 12 years ago

For now I'd rather see you go the route of injecting the default options.