{"id":15293347,"url":"https://github.com/unleash/unleash-client-ruby","last_synced_at":"2025-05-15T07:03:12.583Z","repository":{"id":37514352,"uuid":"138848279","full_name":"Unleash/unleash-client-ruby","owner":"Unleash","description":"Unleash client SDK for Ruby","archived":false,"fork":false,"pushed_at":"2025-04-23T07:01:52.000Z","size":450,"stargazers_count":59,"open_issues_count":7,"forks_count":41,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-15T07:03:05.730Z","etag":null,"topics":["feature","feature-flags","feature-management","feature-toggle","ruby","toggles","unleash","unleash-server"],"latest_commit_sha":null,"homepage":"https://docs.getunleash.io","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Unleash.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-06-27T07:52:20.000Z","updated_at":"2025-04-23T07:00:38.000Z","dependencies_parsed_at":"2025-04-14T10:35:15.563Z","dependency_job_id":"bc94f1a1-03be-4415-8c42-3253fdd9b7e6","html_url":"https://github.com/Unleash/unleash-client-ruby","commit_stats":{"total_commits":244,"total_committers":37,"mean_commits":6.594594594594595,"dds":"0.48360655737704916","last_synced_commit":"3a19f49ad4794241ba6ff6ebe4af68df99a4b4bb"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Unleash%2Funleash-client-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Unleash%2Funleash-client-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Unleash%2Funleash-client-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Unleash%2Funleash-client-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Unleash","download_url":"https://codeload.github.com/Unleash/unleash-client-ruby/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254291961,"owners_count":22046424,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["feature","feature-flags","feature-management","feature-toggle","ruby","toggles","unleash","unleash-server"],"created_at":"2024-09-30T16:46:23.307Z","updated_at":"2025-05-15T07:03:12.576Z","avatar_url":"https://github.com/Unleash.png","language":"Ruby","readme":"# Unleash::Client\n\n![Build Status](https://github.com/Unleash/unleash-client-ruby/actions/workflows/pull_request.yml/badge.svg?branch=main)\n[![Coverage Status](https://coveralls.io/repos/github/Unleash/unleash-client-ruby/badge.svg?branch=main)](https://coveralls.io/github/Unleash/unleash-client-ruby?branch=main)\n[![Gem Version](https://badge.fury.io/rb/unleash.svg)](https://badge.fury.io/rb/unleash)\n\nRuby client for the [Unleash](https://github.com/Unleash/unleash) feature management service.\n\n\u003e  **Migrating to v6**\n\u003e\n\u003e If you use [custom strategies](#custom-strategies) or override built-in ones, read the complete [migration guide](./v6_MIGRATION_GUIDE.md) before upgrading to v6.\n\n\n## Supported Ruby interpreters\n\n- MRI 3.4\n- MRI 3.3\n- MRI 3.2\n- MRI 3.1\n- MRI 3.0\n- MRI 2.7\n- jruby 9.4\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'unleash', '~\u003e 6.3.0'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install unleash\n\n## Configuration\n\nIt is **required** to configure:\n\n- `app_name` with the name of the running application\n- `url` of your Unleash server\n- `custom_http_headers` with `{'Authorization': '\u003cYOUR_API_TOKEN\u003e'}` when using Unleash v4+\n\nIt is **highly recommended** to configure:\n\n- `instance_id` parameter with a unique identifier for the running instance\n\n```ruby\nUnleash.configure do |config|\n  config.app_name            = 'my_ruby_app'\n  config.url                 = '\u003cYOUR_UNLEASH_URL\u003e/api'\n  config.custom_http_headers = {'Authorization': '\u003cYOUR_API_TOKEN\u003e'}\nend\n```\n\nor instantiate the client with the valid configuration:\n\n```ruby\nUNLEASH = Unleash::Client.new(url: '\u003cYOUR_UNLEASH_URL\u003e/api', app_name: 'my_ruby_app', custom_http_headers: {'Authorization': '\u003cYOUR_API_TOKEN\u003e'})\n```\n\n## Dynamic custom HTTP headers\n\nIf you need custom HTTP headers that change during the lifetime of the client, you can pass `custom_http_headers` as a `Proc`.\n\n```ruby\nUnleash.configure do |config|\n  config.app_name            = 'my_ruby_app'\n  config.url                 = '\u003cYOUR_UNLEASH_URL\u003e/api'\n  config.custom_http_headers =  proc do\n    {\n      'Authorization': '\u003cYOUR_API_TOKEN\u003e',\n      'X-Client-Request-Time': Time.now.iso8601\n    }\n  end\nend\n```\n\n#### List of arguments\n\n| Argument              | Description                                                                                                                                                                                                                                                                                                                   | Required? | Type                              | Default value                                  |\n| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | --------------------------------- | ---------------------------------------------- |\n| `url`                 | Unleash server URL.                                                                                                                                                                                                                                                                                                           | Y         | String                            | N/A                                            |\n| `app_name`            | Name of your program.                                                                                                                                                                                                                                                                                                         | Y         | String                            | N/A                                            |\n| `instance_id`         | Identifier for the running instance of your program—set this to be able trace where metrics are being collected from.                                                                                                                                                                  | N         | String                            | random UUID                                    |\n| `environment`         | Unleash context option, for example, `prod` or `dev`. Not yet in use. **Not** the same as the SDK's [Unleash environment](https://docs.getunleash.io/reference/environments).                                                                                                                                         | N         | String                            | `default`                                      |\n| `project_name`        | Name of the project to retrieve feature flags from. If not set, all feature flags will be retrieved.                                                                                                                                                                                                                               | N         | String                            | nil                                            |\n| `refresh_interval`    | How often the Unleash client should check with the server for configuration changes.                                                                                                                                                                                                                                          | N         | Integer                           | 15                                             |\n| `metrics_interval`    | How often the Unleash client should send metrics to server.                                                                                                                                                                                                                                                                   | N         | Integer                           | 60                                             |\n| `disable_client`      | Disables all communication with the Unleash server, effectively taking it _offline_. If set, `is_enabled?` always answer with the `default_value` and configuration validation is skipped. Will also forcefully set `disable_metrics` to `true`. Defeats the entire purpose of using Unleash, except when running tests. | N         | Boolean                           | `false`                                        |\n| `disable_metrics`     | Disables sending metrics to Unleash server. If the `disable_client` option is set to `true`, then this option will also be set to `true`, regardless of the value provided.                                                                                                                                                   | N         | Boolean                           | `false`                                        |\n| `custom_http_headers` | Custom headers to send to Unleash. As of Unleash v4.0.0, the `Authorization` header is required. For example: `{'Authorization': '\u003cYOUR_API_TOKEN\u003e'}`.                                                                                                                                                                              | N         | Hash/Proc                         | {}                                             |\n| `timeout`             | How long to wait for the connection to be established or wait in reading state (open_timeout/read_timeout)                                                                                                                                                                                                                    | N         | Integer                           | 30                                             |\n| `retry_limit`         | How many consecutive failures in connecting to the Unleash server are allowed before giving up. The default is to retry indefinitely.                                                                                                                                                                                         | N         | Float::INFINITY                   | 5                                              |\n| `backup_file`         | Filename to store the last known state from the Unleash server. It is best to not change this from the default.                                                                                                                                                                                                                     | N         | String                            | `Dir.tmpdir + \"/unleash-#{app_name}-repo.json` |\n| `logger`              | Specify a custom `Logger` class to handle logs for the Unleash client.                                                                                                                                                                                                                                                        | N         | Class                             | `Logger.new(STDOUT)`                           |\n| `log_level`           | Change the log level for the `Logger` class. Constant from `Logger::Severity`.                                                                                                                                                                                                                                                | N         | Constant                          | `Logger::WARN`                                 |\n| `bootstrap_config`    | Bootstrap config for loading data on startup—useful for loading large states on startup without (or before) hitting the network.                                                                                                                                                                               | N         | Unleash::Bootstrap::Configuration | `nil`                                          |\n| `strategies`          | Strategies manager that holds all strategies and allows to add custom strategies.                                                                                                                                                                                                                                              | N         | Unleash::Strategies               | `Unleash::Strategies.new`                      |\n\nFor a more in-depth look, please see `lib/unleash/configuration.rb`.\n\n| Environment Variable     | Description                      |\n| ------------------------ | -------------------------------- |\n| `UNLEASH_BOOTSTRAP_FILE` | File to read bootstrap data from |\n| `UNLEASH_BOOTSTRAP_URL`  | URL to read bootstrap data from  |\n\n## Usage in a plain Ruby application\n\n```ruby\nrequire 'unleash'\nrequire 'unleash/context'\n\n@unleash = Unleash::Client.new(app_name: 'my_ruby_app', url: '\u003cYOUR_UNLEASH_URL\u003e/api', custom_http_headers: { 'Authorization': '\u003cYOUR_API_TOKEN\u003e' })\n\nfeature_name = \"AwesomeFeature\"\nunleash_context = Unleash::Context.new\nunleash_context.user_id = 123\n\nif @unleash.is_enabled?(feature_name, unleash_context)\n  puts \" #{feature_name} is enabled according to unleash\"\nelse\n  puts \" #{feature_name} is disabled according to unleash\"\nend\n\nif @unleash.is_disabled?(feature_name, unleash_context)\n  puts \" #{feature_name} is disabled according to unleash\"\nelse\n  puts \" #{feature_name} is enabled according to unleash\"\nend\n```\n\n## Usage in a Rails application\n\n### 1. Add Initializer\n\nThe initializer setup varies depending on whether you’re using a standard setup, Puma in clustered mode, Phusion Passenger, or Sidekiq.\n\n#### 1.a Initializer for standard Rails applications\n\nPut in `config/initializers/unleash.rb`:\n\n```ruby\nUnleash.configure do |config|\n  config.app_name = Rails.application.class.module_parent_name\n  config.url      = '\u003cYOUR_UNLEASH_URL\u003e'\n  # config.instance_id = \"#{Socket.gethostname}\"\n  config.logger   = Rails.logger\n  config.custom_http_headers = {'Authorization': '\u003cYOUR_API_TOKEN\u003e'}\nend\n\nUNLEASH = Unleash::Client.new\n\n# Or if preferred:\n# Rails.configuration.unleash = Unleash::Client.new\n```\n\nFor `config.instance_id` use a string with a unique identification for the running instance. For example, it could be the hostname if you only run one App per host, or the docker container ID, if you are running in Docker.\nIf not set, the client will generate a unique UUID for each execution.\n\nTo have it available in the `rails console` command as well, also add to the file above:\n\n```ruby\nRails.application.console do\n  UNLEASH = Unleash::Client.new\n  # or\n  # Rails.configuration.unleash = Unleash::Client.new\nend\n```\n\n#### 1.b Add Initializer if using [Puma in clustered mode](https://github.com/puma/puma#clustered-mode)\n\nThat is, multiple workers configured in `puma.rb`:\n\n```ruby\nworkers ENV.fetch(\"WEB_CONCURRENCY\") { 2 }\n```\n\n##### with `preload_app!`\n\nThen you may keep the client configuration still in `config/initializers/unleash.rb`:\n\n```ruby\nUnleash.configure do |config|\n  config.app_name    = Rails.application.class.parent.to_s\n  config.url                 = '\u003cYOUR_UNLEASH_URL\u003e/api'\n  config.custom_http_headers = {'Authorization': '\u003cYOUR_API_TOKEN\u003e'}\nend\n```\n\nBut you must ensure that the Unleash client is instantiated only after the process is forked.\nThis is done by creating the client inside the `on_worker_boot` code block in `puma.rb` as below:\n\n```ruby\n#...\npreload_app!\n#...\n\non_worker_boot do\n  # ...\n\n  ::UNLEASH = Unleash::Client.new\nend\n\non_worker_shutdown do\n  ::UNLEASH.shutdown\nend\n```\n\n##### without `preload_app!`\n\nBy not using `preload_app!`:\n\n- The `Rails` constant will **not** be available.\n- Phased restarts will be possible.\n\nYou need to ensure that in `puma.rb`:\n\n- The Unleash SDK is loaded with `require 'unleash'` explicitly, as it will not be pre-loaded.\n- All parameters are set explicitly in the `on_worker_boot` block, as `config/initializers/unleash.rb` is not read.\n- There are no references to `Rails` constant, as that is not yet available.\n\nExample for `puma.rb`:\n\n```ruby\nrequire 'unleash'\n\n#...\n# no preload_app!\n\non_worker_boot do\n  # ...\n\n  ::UNLEASH = Unleash::Client.new(\n    app_name: 'my_rails_app',\n    url: '\u003cYOUR_UNLEASH_URL\u003e/api',\n    custom_http_headers: {'Authorization': '\u003cYOUR_API_TOKEN\u003e'},\n  )\nend\n\non_worker_shutdown do\n  ::UNLEASH.shutdown\nend\n```\n\nNote that we also added shutdown hooks in `on_worker_shutdown`, to ensure a clean shutdown.\n\n#### 1.c Add Initializer if using [Phusion Passenger](https://github.com/phusion/passenger)\n\nThe Unleash client needs to be configured and instantiated inside the `PhusionPassenger.on_event(:starting_worker_process)` code block due to [smart spawning](https://www.phusionpassenger.com/library/indepth/ruby/spawn_methods/#smart-spawning-caveats):\n\nThe initializer in `config/initializers/unleash.rb` should look like:\n\n```ruby\nPhusionPassenger.on_event(:starting_worker_process) do |forked|\n  if forked\n    Unleash.configure do |config|\n      config.app_name    = Rails.application.class.parent.to_s\n      # config.instance_id = \"#{Socket.gethostname}\"\n      config.logger      = Rails.logger\n      config.url                 = '\u003cYOUR_UNLEASH_URL\u003e/api'\n      config.custom_http_headers = {'Authorization': '\u003cYOUR_API_TOKEN\u003e'}\n    end\n\n    UNLEASH = Unleash::Client.new\n  end\nend\n```\n\n#### 1.d Add Initializer hooks when using within [Sidekiq](https://github.com/mperham/sidekiq)\n\nNote that in this case, we require that the code block for `Unleash.configure` is set beforehand.\nFor example in `config/initializers/unleash.rb`.\n\n```ruby\nSidekiq.configure_server do |config|\n  config.on(:startup) do\n    UNLEASH = Unleash::Client.new\n  end\n\n  config.on(:shutdown) do\n    UNLEASH.shutdown\n  end\nend\n```\n\n### 2. Set Unleash::Context\n\nAdd the following method and callback in the application controller to have `@unleash_context` set for all requests:\n\nAdd in `app/controllers/application_controller.rb`:\n\n```ruby\n  before_action :set_unleash_context\n\n  private\n  def set_unleash_context\n    @unleash_context = Unleash::Context.new(\n      session_id: session.id,\n      remote_address: request.remote_ip,\n      user_id: session[:user_id]\n    )\n  end\n```\n\nAlternatively, you can add this method only to the controllers that use Unleash.\n\n### 3. Sample usage\n\nThen wherever in your application that you need a feature toggle, you can use:\n\n```ruby\nif UNLEASH.is_enabled? \"AwesomeFeature\", @unleash_context\n  puts \"AwesomeFeature is enabled\"\nend\n```\n\nor if client is set in `Rails.configuration.unleash`:\n\n```ruby\nif Rails.configuration.unleash.is_enabled? \"AwesomeFeature\", @unleash_context\n  puts \"AwesomeFeature is enabled\"\nend\n```\n\nIf you don't want to check a feature is disabled with `unless`, you can also use `is_disabled?`:\n\n```ruby\n# so instead of:\nunless UNLEASH.is_enabled? \"AwesomeFeature\", @unleash_context\n  puts \"AwesomeFeature is disabled\"\nend\n\n# it might be more intelligible:\nif UNLEASH.is_disabled? \"AwesomeFeature\", @unleash_context\n  puts \"AwesomeFeature is disabled\"\nend\n```\n\nIf the feature is not found in the server, it will by default return false.\nHowever, you can override that by setting the default return value to `true`:\n\n```ruby\nif UNLEASH.is_enabled? \"AwesomeFeature\", @unleash_context, true\n  puts \"AwesomeFeature is enabled by default\"\nend\n# or\nif UNLEASH.is_disabled? \"AwesomeFeature\", @unleash_context, true\n  puts \"AwesomeFeature is disabled by default\"\nend\n```\n\nAnother possibility is to send a block, [Lambda](https://ruby-doc.org/core-3.0.1/Kernel.html#method-i-lambda) or [Proc](https://ruby-doc.org/core-3.0.1/Proc.html#method-i-yield)\nto evaluate the default value:\n\n```ruby\nnet_check_proc = proc do |feature_name, context|\n  context.remote_address.starts_with?(\"10.0.0.\")\nend\n\nif UNLEASH.is_enabled?(\"AwesomeFeature\", @unleash_context, \u0026net_check_proc)\n  puts \"AwesomeFeature is enabled by default if you are in the 10.0.0.* network.\"\nend\n```\n\nor\n\n```ruby\nawesomeness = 10\n@unleash_context.properties[:coolness] = 10\n\nif UNLEASH.is_enabled?(\"AwesomeFeature\", @unleash_context) { |feat, ctx| awesomeness \u003e= 6 \u0026\u0026 ctx.properties[:coolness] \u003e= 8 }\n  puts \"AwesomeFeature is enabled by default if both the user has a high enough coolness and the application has a high enough awesomeness\"\nend\n```\n\nNote:\n\n- The block/lambda/proc can use the feature name and context as arguments.\n- The client will evaluate the fallback function once per call of `is_enabled()`.\n  Please keep this in mind when creating your fallback function.\n- The returned value of the block should be a boolean.\n  However, the client will coerce the result to a boolean via `!!`.\n- If both a `default_value` and `fallback_function` are supplied,\n  the client will define the default value by `OR`ing the default value and the output of the fallback function.\n\nAlternatively by using `if_enabled` (or `if_disabled`) you can send a code block to be executed as a parameter:\n\n```ruby\nUNLEASH.if_enabled \"AwesomeFeature\", @unleash_context, true do\n  puts \"AwesomeFeature is enabled by default\"\nend\n```\n\nNote: `if_enabled` (and `if_disabled`) only support `default_value`, but not `fallback_function`.\n\n#### Variations\n\nIf no flag is found in the server, use the fallback variant.\n\n```ruby\nfallback_variant = Unleash::Variant.new(name: 'default', enabled: true, payload: {\"color\" =\u003e \"blue\"})\nvariant = UNLEASH.get_variant \"ColorVariants\", @unleash_context, fallback_variant\n\nputs \"variant color is: #{variant.payload.fetch('color')}\"\n```\n\n## Bootstrapping\n\nBootstrap configuration allows the client to be initialized with a predefined set of toggle states.\nBootstrapping can be configured by providing a bootstrap configuration when initializing the client.\n\n```ruby\n@unleash = Unleash::Client.new(\n    url: '\u003cYOUR_UNLEASH_URL\u003e/api',\n    app_name: 'my_ruby_app',\n    custom_http_headers: { 'Authorization': '\u003cYOUR_API_TOKEN\u003e' },\n    bootstrap_config: Unleash::Bootstrap::Configuration.new({\n        url: \"\u003cYOUR_UNLEASH_URL\u003e/api/client/features\",\n        url_headers: {'Authorization': '\u003cYOUR_API_TOKEN\u003e'}\n    })\n)\n```\n\nThe `Bootstrap::Configuration` initializer takes a hash with one of the following options specified:\n\n- `file_path` - An absolute or relative path to a file containing a JSON string of the response body from the Unleash server. This can also be set through the `UNLEASH_BOOTSTRAP_FILE` environment variable.\n- `url` - A url pointing to an Unleash server's features endpoint, the code sample above is illustrative. This can also be set through the `UNLEASH_BOOTSTRAP_URL` environment variable.\n- `url_headers` - Headers for the GET HTTP request to the `url` above. Only used if the `url` parameter is also set. If this option isn't set then the bootstrapper will use the same url headers as the Unleash client.\n- `data` - A raw JSON string as returned by the Unleash server.\n- `block` - A lambda containing custom logic if you need it, an example is provided below.\n\nYou should only specify one type of bootstrapping since only one will be invoked and the others will be ignored.\nThe order of preference is as follows:\n\n- Select a data bootstrapper if it exists.\n- If no data bootstrapper exists, select the block bootstrapper.\n- If no block bootstrapper exists, select the file bootstrapper from either parameters or the specified environment variable.\n- If no file bootstrapper exists, then check for a URL bootstrapper from either the parameters or the specified environment variable.\n\nExample usage:\n\nFirst, save the toggles locally:\n\n```shell\ncurl -H 'Authorization: \u003cYOUR_API_TOKEN\u003e' -XGET '\u003cYOUR_UNLEASH_URL\u003e/api' \u003e ./default-toggles.json\n```\n\nThen use them on startup:\n\n```ruby\n\ncustom_boostrapper = lambda {\n  File.read('./default-toggles.json')\n}\n\n@unleash = Unleash::Client.new(\n    app_name: 'my_ruby_app',\n    url: '\u003cYOUR_UNLEASH_URL\u003e/api',\n    custom_http_headers: { 'Authorization': '\u003cYOUR_API_TOKEN\u003e' },\n    bootstrap_config: Unleash::Bootstrap::Configuration.new({\n        block: custom_boostrapper\n    })\n)\n```\n\nThis example could be easily achieved with a file bootstrapper, this is just to illustrate the usage of custom bootstrapping.\nBe aware that the client initializer will block until bootstrapping is complete.\n\n#### Client methods\n\n| Method name    | Description                                                                                                                                                                                     | Return type        |\n| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |\n| `is_enabled?`  | Checks if a feature toggle is enabled or not                                                                                                                                                | Boolean            |\n| `enabled?`     | A more idiomatic Ruby alias for the `is_enabled?` method                                                                                                                                     | Boolean            |\n| `if_enabled`   | Runs a code block, if a feature is enabled                                                                                                                                                      | `yield`            |\n| `is_disabled?` | Checks if feature toggle is enabled or not                                                                                                                                                | Boolean            |\n| `disabled?`    | A more idiomatic Ruby alias for the `is_disabled?` method                                                                                                                                    | Boolean            |\n| `if_disabled`  | Runs a code block, if a feature is disabled                                                                                                                                                     | `yield`            |\n| `get_variant`  | Gets variant for a given feature                                                                                                                                                                 | `Unleash::Variant` |\n| `shutdown`     | Saves metrics to disk, flushes metrics to server, and then kills `ToggleFetcher` and `MetricsReporter` threads—a safe shutdown, not generally needed in long-running applications, like web applications | nil                |\n| `shutdown!`    | Kills `ToggleFetcher` and `MetricsReporter` threads immediately                                                                                                                                     | nil                |\n\nFor the full method signatures, see [client.rb](lib/unleash/client.rb).\n\n## Local test client\n\n```\n# cli unleash client:\nbundle exec bin/unleash-client --help\n\n# or a simple sample implementation (with values hardcoded):\nbundle exec examples/simple.rb\n```\n\n## Available strategies\n\nThis client comes with all the required strategies out of the box:\n\n- ApplicationHostnameStrategy\n- DefaultStrategy\n- FlexibleRolloutStrategy\n- GradualRolloutRandomStrategy\n- GradualRolloutSessionIdStrategy\n- GradualRolloutUserIdStrategy\n- RemoteAddressStrategy\n- UnknownStrategy\n- UserWithIdStrategy\n\n## Custom strategies\n\nYou can add [custom activation strategies](https://docs.getunleash.io/advanced/custom_activation_strategy) using configuration.\nIn order for the strategy to work correctly it should support two methods `name` and `is_enabled?`.\n\n```ruby\nclass MyCustomStrategy\n  def name\n    'myCustomStrategy'\n  end\n\n  def is_enabled?(params = {}, context = nil)\n    true\n  end\nend\n\nUnleash.configure do |config|\n  config.strategies.add(MyCustomStrategy.new)\nend\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies.\nThen, run `bundle exec rake spec` to run the tests.\nYou can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nThis SDK is also built against the Unleash Client Specification tests.\nTo run the Ruby SDK against this test suite, you'll need to have a copy on your machine, you can clone the repository directly using:\n\n`git clone --branch v$(ruby echo_client_spec_version.rb) https://github.com/Unleash/client-specification.git`\n\nAfter doing this, `bundle exec rake spec` will also run the client specification tests.\n\nTo install this gem onto your local machine, run `bundle exec rake install`.\n\n## Releasing\n\nTo release a new version, follow these steps:\n\n1. Update version number:\n     - Increment the version number in the `./lib/unleash/version.rb` file according to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) guidelines.\n2. Update documentation:\n     - If the update includes a major or minor version change, update the [Installation section](#installation) in [README.md](README.md).\n     - Update [CHANGELOG.md](CHANGELOG.md) following the format on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).\n3. Commit changes:\n     - Commit the changes with a message like: `chore: bump version to x.y.z.`\n4. Release the gem:\n   \t- On the `main` branch, run `bundle exec rake release` to create a git tag for the new version, push commits and tags to origin, and publish `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/unleash/unleash-client-ruby.\n\nBe sure to run both `bundle exec rspec` and `bundle exec rubocop` in your branch before creating a pull request.\n\nPlease include tests with any pull requests, to avoid regressions.\n\nCheck out our guide for more information on how to build and scale [feature flag systems](https://docs.getunleash.io/topics/feature-flags/feature-flag-best-practices).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funleash%2Funleash-client-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funleash%2Funleash-client-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funleash%2Funleash-client-ruby/lists"}