0.01
No release in over 3 years
Low commit activity in last 3 years
Chirrin for the new code apears, Chirrion for the new code desapears (by Chapolim)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.8
~> 10.0
~> 3.2.1
~> 3.2.0

Runtime

>= 1
 Project Readme

Chirrin Chirrion

Chirrin Chirrion is a gem to manage feature toggle, allowing developers to easily change the software behavior by showing/hiding new features and fixes.

Inspiration

The gem name was inspired by a funny Chapolim Colorado episode called 'Chirrin Chirrion del Diablo', where there was a magic wand that created new things if its bearer used the magic word 'chirrin', and those things were destroyed with the word 'chirrion'.

Install

gem install chirrin-chirrion

How to use

Configuration

require 'chirrin-chirrion'
redis_connection = Redis.new
redis_adapter = ChirrinChirrion::DatabaseAdapters::RedisAdapter.new(redis_connection)
ChirrinChirrion.config(database_adapter: redis_adapter)

Listing toggles

ChirrinChirrion.list
# => [#<OpenStruct description="What the toggle does.", active=true, name="toggle_name">]

Adding a toggle

ChirrinChirrion.add_toggle('new_user_register_validation', {active: true, description: 'When this is active, gender, age and phone number are not required'})

Removing a toggle

ChirrinChirrion.remove_toggle('new_user_register_validation')

Making a toggle active

ChirrinChirrion.chirrin!('new_user_register_validation')

Making a toggle inactive

ChirrinChirrion.chirrion!('new_user_register_validation')

Using a toggle with if else

if ChirrinChirrion.chirrin?('new_user_register_validation')
  # new busines rules
else
  # old busines rules
end

Using with procs and default values

chirrin_behavior = lambda do
  # do a lot of things
  { result: 'of things' }
end

chirrion_behavior = { result: 'old static result' }

ChirrinChirrion.chirrin_chirrion('my_toggle', chirrin_behavior, chirrion_behavior)