From 2cbcf9c7d6ccb1f3b02cc0d983fc5da2869878ab Mon Sep 17 00:00:00 2001 From: Guillaume DOTT Date: Mon, 18 Aug 2014 12:00:24 +0200 Subject: [PATCH] Describe Redis repository in README --- README.md | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 79a2d12..ea5b3e5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # Flop -A simple ruby feature flipper. +Flop is a feature flipper gem for ruby. + +Toggle features on and off easily and store feature states in memory or in redis +with the different repositories. ## Installation @@ -16,9 +19,7 @@ Or install it yourself as: $ gem install flop -## Usage - -### Repositories +## Repositories First, you need to configure where to store everything by setting a repository. @@ -35,7 +36,20 @@ require 'redis' Flop.repo = Flop::Repository::Redis.new(Redis.new) ``` -### Features +### Redis + +The `Redis` repository requires a `Redis` connection as its first parameter. +The default namespace can be passed as a second parameter. + +The default namespace can be a string, an array or a proc. + +```ruby +Flop::Repository::Redis.new(Redis.new, "flop:namespace") +Flop::Repository::Redis.new(Redis.new, [:flop, :namespace]) +Flop::Repository::Redis.new(Redis.new, -> { ENV['NAMESPACE'] }) +``` + +## Features To access a feature, you can call the Flop[] method or create a new `Flop::Feature` object. ```ruby