GithubHelp home page GithubHelp logo

rollout_percentage's Introduction

CircleCI

RolloutPercentage

The implementation of user-percentages feature but without required object https://github.com/fetlife/rollout#user-percentages

Installation

Add this line to your application's Gemfile:

gem 'rollout_percentage'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install rollout_percentage

Usage

Rollout Client example

Simple implementation with redis-rb

require 'redis'

class RolloutClient
  attr_accessor :redis

  def initialize(**args)
    self.redis = Redis.new(args)
  end

  def get(key)
    redis.get(key)
  end

  def set(key, value)
    redis.set(key, value)
  end
end

Manage percentage by rails console:

rollout_client = RolloutClient.new(url: url)

feature_flag - @symbol percentage_enabling - @integer

rollout_client.set(feature_flag, percentage_enabling)
rollout_client.get(feature_flag)

RolloutPercentage usage example:

RolloutPercentage.new(feature_flag: feature_flag, rollout_client: rollout_client).perform
  # => returns the boolean randomized by percentage

RolloutPercentage.new(feature_flag: :feature_flag, rollout_client: rollout_client).perform do
  # => some block code here which should be run on randomized by percentage
end

Development

After checking out the repo, run bundle install to install dependencies. Then, run rake spec to run the tests.

To install this gem onto your local machine, run rake install. To release a new version, update the version number (RolloutPercentage::VERSION) in lib/rollout_percentage.rb, and then run rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Mifrill/rollout_percentage. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the RolloutPercentage project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

rollout_percentage's People

Contributors

mifrill avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.