Describe Redis repository in README
parent
41b4abe0db
commit
2cbcf9c7d6
24
README.md
24
README.md
|
@ -1,6 +1,9 @@
|
||||||
# Flop
|
# 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
|
## Installation
|
||||||
|
|
||||||
|
@ -16,9 +19,7 @@ Or install it yourself as:
|
||||||
|
|
||||||
$ gem install flop
|
$ gem install flop
|
||||||
|
|
||||||
## Usage
|
## Repositories
|
||||||
|
|
||||||
### Repositories
|
|
||||||
|
|
||||||
First, you need to configure where to store everything by setting a repository.
|
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)
|
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.
|
To access a feature, you can call the Flop[] method or create a new `Flop::Feature` object.
|
||||||
```ruby
|
```ruby
|
||||||
|
|
Loading…
Reference in New Issue