Ruby SDK
feat-sdk (RubyGems) is the Ruby SDK. Standard library only, no gem dependencies. Evaluates flags locally against a polled datafile.
Install
Section titled “Install”# Gemfilegem "feat-sdk"bundle installRuby 3.0 or newer.
require "feat"
client = Feat::Client.new( api_key: ENV.fetch("FEAT_SERVER_KEY"), data_plane_url: "https://data.feat.so",)client.start
ctx = { targetingKey: "user-123", user: { plan: "pro", email: "alice@example.com" },}
if client.get_boolean_value("checkout-v2", false, ctx) # ...end
client.closeUse a server key (feat_sdk_…).
enabled = client.get_boolean_value("checkout-v2", false, ctx)variant = client.get_string_value("hero-copy", "control", ctx)limit = client.get_number_value("rate-limit", 100, ctx)config = client.get_object_value("layout-config", {}, ctx)
result = client.evaluate("checkout-v2", false, ctx)# result.value, result.variation_id, result.reason, result.error_messagereason is one of TARGETING_MATCH, SPLIT, FALLTHROUGH, DEFAULT, DISABLED, ERROR. See Evaluation order.
Lifecycle
Section titled “Lifecycle”Feat::Client.new(...)constructs.client.startspawns the polling thread. Callclient.ready(or block on it implicitly via the first evaluation) before relying on values.client.closestops the thread cleanly.
Configuration
Section titled “Configuration”Feat::Client.new( api_key: ENV.fetch("FEAT_SERVER_KEY"), data_plane_url: "https://data.feat.so", poll_interval: 30, # seconds; default 30, minimum 5 bootstrap: nil, # optional: a parsed datafile hash to skip the first fetch)Semantics
Section titled “Semantics”The Ruby SDK ports the same evaluation algorithm as @feathq/feat-eval bit-for-bit. The same datafile, the same context, and the same flag key always give the same result across Node.js, Go, Python, and Ruby.