Skip to main content

Announcing the ConfigCat Ruby SDK. Yaaaaaay!

· 2 min read
Endre Toth
Large scale enterprise development expert. The father of our SDKs and infrastructure.

We'd like to make ConfigCat available for as many users as possible. Our SDKs are available in multiple languages. But still lots of our users missed Ruby support in ConfigCat:

  • Does configcat have Ruby sdk??
  • So I am sad you don’t have a Ruby client I can see.
  • Are you planning to support Ruby?

The Ruby SDK

Finally we decided to create a standalone Ruby SDK.
Ruby is an interpreted language. It's very similar to Python and we already have an SDK written in Python. Taking advantage of this, the first idea was that we simply convert our Python code to Ruby and everything will be just fine.

So, is it enough to convert the files like this?

py2rb configcat.py configcat.rb -w

No.

We experienced that the generated .rb file is not always perfect (it’s possible that doesn’t even compile). But it's a pretty good starting point and after some changes we can create the ruby version of the original code.

Of course after that, we had to create CI for the new SDK and make it possible to run the converted unit and integration tests.

Installation

Now it's ready to use. Just grab the ruby package from RubyGems:

gem install configcat

Usage

And use your feature flag:

require 'configcat'

configcat_client = ConfigCat.create_client("#YOUR-SDK-KEY#")
isMyAwesomeFeatureEnabled = configcat_client.get_value("isMyAwesomeFeatureEnabled", false)
if isMyAwesomeFeatureEnabled
do_the_new_thing()
else
do_the_old_thing()
end

You can check it out easily at https://app.configcat.com.
On GitHub: https://github.com/configcat/ruby-sdk.
And in the docs: https://configcat.com/docs/sdk-reference/ruby/.

Happy coding!

If you run into any problem, just drop us an email at [email protected].