LaunchDarkly SDK for Ruby
Quick setup
Install the Ruby SDK with
gem
gem install ldclient-rb
Require the LaunchDarkly client:
require 'ldclient-rb'
Create a new LDClient with your API key:
client = LaunchDarkly::LDClient.new("your_api_key")
Your first feature flag
- Create a new feature flag on your dashboard
In your application code, use the feature's key to check wthether the flag is on for each user:
if client.toggle?("your.flag.key", {:key => "[email protected]"}, false) # application code to show the feature else # the code to run if the feature is off end
Learn more
Check out our documentation for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the complete reference guide for this SDK.
Contributing
We encourage pull-requests and other contributions from the community. We've also published an SDK contributor's guide that provides a detailed explanation of how our SDKs work.