ToggleFleet
Ruby feature flags · local evaluation

Keep the decision
inside your process.

ToggleFleet gives Ruby applications five release-control gates without putting a network request inside the flag check. Load an environment configuration in the background, evaluate locally, and keep a safe path when the control plane is unavailable.

Hot pathLocal Ruby evaluation
RefreshConditional ETag requests
FallbackLast-good or safe default
CredentialsOne key per environment
01 / Release workflow

Put a stable control around a change.

A flag key stays in application code while its state changes in each environment. Start with a non-critical path, prove the off state, then promote the tested state deliberately.

  1. Create a flag such as checkout_v2 in a workspace.
  2. Generate a separate SDK key for Development, Staging, or Production.
  3. Configure the Ruby client with a safe default and start background refresh.
  4. Guard the code path, test both branches, and change the audience from the dashboard.
key
Keep the SDK key server-side.

It reads the complete environment configuration. Store it in the application secret mechanism, not browser code, source control, logs, or screenshots.

02 / Targeting model

Choose the gate that matches the release.

A flag is on when any configured gate matches. Gate state is isolated by environment, so Development and Production can make different decisions for the same key.

GateUse it forBehavior
BooleanAll usersOn for every evaluation in the selected environment.
ActorNamed accounts or tenantsOn for listed stable actor identifiers.
GroupApplication-defined cohortsOn when a registered predicate or explicit group matches.
% of actorsGradual rolloutDeterministic per flag and actor; the cohort stays sticky as the percentage changes.
% of timeSamplingRandom per evaluation; not a sticky cohort.
03 / Ruby SDK

One initializer, one local check.

The gem uses Ruby's standard library, fetches configuration in the background, and exposes the same decision surface in Rails or a standalone Ruby process.

config/initializers/togglefleet.rbserver-side Ruby
ToggleFleet.configure do |config|
  config.sdk_key = ENV.fetch("TOGGLEFLEET_SDK_KEY")
  config.default = false
  config.refresh_interval = 15
end

ToggleFleet.start

if ToggleFleet.enabled?(:checkout_v2, actor: current_user)
  render "checkout/v2"
else
  render "checkout/current"
end

The enabled? call reads the latest configuration held in memory. It does not block on a ToggleFleet request.

04 / Failure boundary

Refresh in the background. Keep deciding.

local

Hot path

After a configuration load, flag checks are in-process lookups rather than control-plane requests.

304

Conditional refresh

The SDK sends an ETag on background polls. Unchanged configuration returns HTTP 304 with no JSON body to parse.

last

Last-good state

A failed refresh leaves the last loaded configuration in place. Unknown flags use the configured default before the first successful load.

actor

Stable targeting

Actor IDs feed deterministic percentage bucketing, so a rollout does not flicker for the same flag and actor.

05 / Other server-side clients

Use the REST API when Ruby is not the caller.

Non-Ruby services can fetch an environment or evaluate one flag with an SDK key. Prefer /v1/config plus local evaluation for repeated checks; keep the credential on the server.

server-side HTTPREST API v1
# Fetch and cache an environment
curl https://togglefleet.com/v1/config \
  -H "Authorization: Bearer $TOGGLEFLEET_SDK_KEY" \
  -H 'If-None-Match: "…"'

# Or evaluate one flag
curl https://togglefleet.com/v1/evaluate \
  -H "Authorization: Bearer $TOGGLEFLEET_SDK_KEY" \
  -G --data-urlencode "flag=checkout_v2" \
     --data-urlencode "actor=account_42"
!
No browser CORS.

The API intentionally does not expose environment configuration to browser JavaScript. Use the SDK or a server-side integration.

06 / FAQ

Questions before the first guarded branch.

Does a Ruby flag check call ToggleFleet over the network?

No. After configuration is loaded, ToggleFleet.enabled? reads in-process state. Background refresh uses conditional ETag requests separately.

Which feature-flag gates are available?

Boolean, actor, group, percentage of actors, and percentage of time. Gate state is independent for each environment.

What happens if ToggleFleet is unreachable?

The SDK keeps the last successfully loaded configuration. Before the first successful load, an unknown flag returns the configured safe default, which is false by default.

Are percentage-of-actors rollouts sticky?

Yes. The gate uses the flag and actor identifiers for deterministic bucketing. Percentage-of-time is random per evaluation and should not be used when stickiness matters.

Can another language use ToggleFleet?

Yes. Server-side clients can call /v1/config or /v1/evaluate with an environment SDK key. Keep the key out of browser bundles and prefer local evaluation for repeated checks.

A safer first release starts small

Try one flag before you move the fleet.

Create a free workspace, connect Development, and verify both branches before changing a production audience.