Skip to content

Commit

Permalink
Improve README about setting backend and Rails
Browse files Browse the repository at this point in the history
  • Loading branch information
okuramasafumi committed Aug 8, 2020
1 parent f83fb0b commit 9922df2
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@ Or install it yourself as:

## Usage

### Configuration

Alba's configuration is fairly simple.

#### Backend

Backend is the actual part serializing an object into JSON. Alba supports these backends.

* Oj, the fastest. Gem installation required.
* active_support, mostly for Rails. Gem installation required.
* default or json, with no external dependencies.

You can set a backend like this:

```ruby
Alba.backend = :oj
```

### Simple serialization with key

```ruby
Expand Down Expand Up @@ -130,6 +148,14 @@ Although this might be useful sometimes, it's generally recommended to define a
Alba is faster than alternatives.
For a performance benchmark, see https://gist.github.com/okuramasafumi/4e375525bd3a28e4ca812d2a3b3e5829.

## Rails

When you use Alba in Rails, you can create an initializer file with the line below for compatibility with Rails JSON encoder.

```ruby
Alba.backend = :active_support
```

## Why named "Alba"?

The name "Alba" comes from "albatross", a kind of birds. In Japanese, this bird is called "Aho-dori", which means "stupid bird". I find it funny because in fact albatrosses fly really fast. I hope Alba looks stupid but in fact it does its job quick.
Expand Down

0 comments on commit 9922df2

Please sign in to comment.