No commit activity in last 3 years
No release in over 3 years
A Simple feature toggle for a Rails app
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.14
~> 10.0
~> 3.0
 Project Readme

FeatureToggle

A simple feature Toggle for a Rails app.

Installation

Add this line to your application's Gemfile:

gem 'arkency-feature_toggle'

And then execute:

$ bundle

Or install it yourself as:

$ gem install arkency-feature_toggle

Usage

Defining toggles

FT = FeatureToggle.new.tap do |ft|
  ft.for(:new_user_profile) do |user_id:|
    Admin.where(user_id: user_id).exists?
  end
end

Enabling given feature via toggle

class UserProfilesController < ApplicationController
  def show
    FT.with(:new_user_profile, user_id: current_user.id) do
      return render :new_user_profile, locals: { user: NewUserProfilePresenter.new(current_user) }
    end

    render :show, locals: { user: UserProfilePresenter.new(current_user) }
  end
end

Convenience alias

require 'arkency/feature_toggle/alias'

From now on you can use top-level ::FeatureToggle.

Read more

[A simple feature toggle for a Rails app] (http://blog.arkency.com/2015/11/simple-feature-toggle-for-rails-app/) on Arkency blog.

About

Arkency

Feature Toggle funded and maintained by Arkency. Check out our other open-source projects.

You can also hire us or read our blog.