apeckham / switches
- Source
- Commits
- Network (0)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
switches /
| name | age | message | |
|---|---|---|---|
| |
README | Tue Nov 11 16:14:19 -0800 2008 | |
| |
Rakefile | Tue Nov 11 14:54:59 -0800 2008 | |
| |
init.rb | Fri Feb 06 13:29:02 -0800 2009 | |
| |
lib/ | Tue Feb 17 16:39:16 -0800 2009 | |
| |
tasks/ | Tue Nov 11 14:54:59 -0800 2008 | |
| |
test/ | Tue Feb 17 16:39:16 -0800 2009 |
README
switches - Runtime switches for a Rails app Sometimes I want to turn on and off features of my application without code changes. For example, sometimes my application runs in read-only mode, but most of the time it's in read-write mode. In read-only mode I want certain features to not appear. This code uses files on disk to determine whether a switch is enabled. Create your own switch by extending Switch::Base: class ReadOnlySwitch < Switch::Base end Then turn it on with ReadOnlySwitch.turn_on. Wherever behavior should change based on whether the switch is on, use "if ReadOnlySwitch.is_on?" The files on disk that indicate whether a switch is on are stored in config/switch.
