Skip to content

Conversation

@jbockler
Copy link

Add Rk.configure which accepts a name that will create name_rk. You can create multiple rk configurations with that if you need the keys in different formats.

Remove date from gemspec since it gets automatically added when building the gem

Add development dependencies to gemspec for dev setup via: gem install --development rk

Fix bug that it was not possible to ask rk for configurations options (separator, prefix & suffix)


The app i am currently working on is connected to two different redis databases. Unfortunately both use a different format for the keys. I would like to use this gem, since i enjoyed using it in the past. But due to the global configuration it wasn't possible.

With my changes it is now possible to create different named configurations:

Rk.configre("foo") do |config|
  config.separator = ":"
end

Rk.configure("bar") do |config|
  config.separator = "-"
end

foo_rk("test", 1)
=> test:1

bar_rk("test", 1)
=> test-1

I tried not to create breaking changes. It should be totally fine to use rk just as before. The only change that may break something is that calling rk with a non existing key now returns a NoMethodError instead of a runtime error.

Let me know what you think about this. If you like it, i can change the README too.

Add `Rk.configure` which accepts a name that will create `name_rk`.
You can create multiple rk configurations with that if you need the keys
in different formats.

Remove date from gemspec since it gets automatically added
when building the gem

Add development dependencies to gemspec for dev setup via:
`gem install --development rk`

Fix bug that it was not possible to ask rk for configurations options
(separator, prefix & suffix)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant