Create a flag in the dashboard, grab your environment's SDK key, and check it with one method call. The gem evaluates locally — no network on the hot path — and the same logic is available as a plain REST API for any language.
1 · Install
The SDK is open source (MIT) and published on RubyGems.
gem "togglefleet"Then bundle install. Source & issues: github.com/takeaseatventure/togglefleet-ruby.
2 · Configure
Each environment (Production, Staging, Development, or any custom one) has its own SDK key, found under Settings → SDK keys in the dashboard.
ToggleFleet.configure do |c| c.sdk_key = ENV["TOGGLEFLEET_SDK_KEY"] c.refresh_interval = 15 # seconds between background refreshes c.default = false # fail-safe value for unknown flags end # groups are decided in YOUR code ToggleFleet.register_group(:admins) { |u| u.admin? } ToggleFleet.register_group(:internal) { |u| u.email.end_with?("@yourco.com") } ToggleFleet.start # initial fetch + background refresh thread
Then check a flag anywhere — this never blocks on the network:
if ToggleFleet.enabled?(:checkout_v2, actor: current_user) render "checkout/v2" end
3 · The gates
Evaluated in order — the first match wins. Set any of them per environment in the dashboard.
| Gate | Set it to… | Effect |
|---|---|---|
| Boolean | Fully on | on for everyone |
| Actor | a list of actor IDs | on for those specific actors |
| Group | group names | on for actors your registered predicate matches |
| % of actors | 0–100 | sticky — the same actors keep it as you ramp |
| % of time | 0–100 | random per call |
4 · Actors & groups
An actor is anything you flag on. The gem derives a stable id: actor.togglefleet_id if defined, else actor.id (works for ActiveRecord out of the box), else the value itself.
ToggleFleet.enabled?(:beta, actor: current_user) # uses current_user.id ToggleFleet.enabled?(:beta, actor: "account_42") # a plain string id ToggleFleet.enabled?(:beta, actor: user, groups: [:eu]) # explicit groups too ToggleFleet.all(actor: current_user) # { "checkout_v2" => true, ... }
5 · REST API
No Ruby? Authenticate with an environment's SDK key and call the API directly.
Server-side check for one flag. Pass groups when you need the group gate (group membership is otherwise resolved in your app).
curl https://togglefleet.com/v1/evaluate \ -H "Authorization: Bearer tf_…" \ -G --data-urlencode "flag=checkout_v2" \ --data-urlencode "actor=dave" # → { "flag": "checkout_v2", "enabled": true }
The whole environment, so you can cache and evaluate locally (this is what the gem does).
curl https://togglefleet.com/v1/config -H "Authorization: Bearer tf_…" # → { "flags": { "checkout_v2": { "boolean": false, # "percentage_of_actors": 25, "percentage_of_time": 0, # "actors": ["dave"], "groups": ["admins"], "id": "…" } } }
Percentage bucketing is byte-identical between the gem and the API, so a sticky rollout is consistent however you evaluate it.
Reliability
enabled? never blocks on the network.304 and zero parsing.c.on_evaluation = ->(flag, actor, result) { … }