We've built a simple console application that demonstrates how LaunchDarkly's SDK works.
Below, you'll find the basic build procedure, but for more comprehensive instructions, you can visit your Quickstart page or the Ruby SDK reference guide.
This demo requires Ruby version 2.5.0 or higher (or, for JRuby, 9.2.0 or higher).
- Edit
main.rband set the value ofsdk_keyto your LaunchDarkly SDK key. If there is an existing boolean feature flag in your LaunchDarkly project that you want to evaluate, setfeature_flag_keyto the flag key.
sdk_key = "1234567890abcdef"
feature_flag_key = "my-flag"-
If you have not installed the
bundlertool, rungem install bundleron the command line. -
On the command line, run
bundle install -
Run
bundle exec ruby main.rb
You should see the message "Feature flag '<flag key>' is <true/false> for this user".