Created
February 10, 2015 00:25
-
-
Save nathancarnes/9cb9e3cf21dccace3a2e to your computer and use it in GitHub Desktop.
An amazing library for feature flags in Rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Just put this into lib/, and add your methods! | |
# Usage: Features.your_feature_name? | |
class Features | |
# Admin-only features? We've got that! | |
def self.reticulate_splines? | |
current_user && current_user.admin? | |
end | |
# Don't want to deploy to flip it on or off? It supports that! | |
def self.release_the_hounds? | |
ENV['RELEASE_THE_HOUNDS'].present? | |
end | |
# Whoa whoa whoa. What about time-based releases? YUP! | |
def self.be_awesome? | |
Time.current < Time.new(2525, 01, 01) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment