# Flipper Feature Flags: Ruby Feature Toggles

# Flipper Feature Flags: Ruby Feature Toggles

Flipper is a popular feature flag management library for Ruby applications that enables controlled feature rollouts, A/B testing, and gradual deployments.

## Key Features

### 1. **Simple API**
```ruby
# Basic feature check
if Flipper.enabled?(:new_checkout)
  # New checkout flow
else
  # Legacy checkout flow
end
```

### 2. **Multiple Gate Types**

| Gate Type | Use Case |
|-----------|----------|
| **Boolean** | Simple on/off toggle |
| **Percentage** | Gradual rollout (0-100%) |
| **Actor** | Enable for specific users |
| **Group** | Enable for user segments |
| **Time** | Scheduled enablement |

### 3. **Configuration Examples**

```ruby
# Enable for all users
Flipper.enable(:feature_name)

# Enable for percentage of users
Flipper[:feature_name].enable_percentage_of_actors(10)

# Enable for specific user
Flipper[:feature_name].enable_actor(current_user)

# Enable for user group
Flipper[:feature_name].enable_group(:admins)

# Disable feature
Flipper.disable(:feature_name)
```

## Setup

```ruby
# Gemfile
gem 'flipper'
gem 'flipper-active_record'  # or other adapter

# config/initializers/flipper.rb
Flipper.configure do |config|
  config.default { Flipper::Adapters::ActiveRecord.new }
end
```

## Common Use Cases

- **Gradual Rollouts**: Release features to 5% → 25% → 50% → 100%
- **A/B Testing**: Compare feature variants
- **Kill Switches**: Quickly disable problematic features
- **User Segments**: Beta features for specific groups
- **Canary Deployments**: Test with subset before full release

## Benefits

✅ Zero-downtime deployments  
✅ Easy rollback  
✅ Data-driven decisions  
✅ Reduced risk  
✅ Improved developer workflow

Flipper integrates seamlessly with Rails and provides both UI dashboards and programmatic control for managing feature flags.
