elixir-lang/plug — pull request #149 by whatyouhide (2014-12-12 09:02:03+00:00)
Title: Plug.Builder docs and refactoring

I made major docs additions and some code refactoring in `Plug.Builder`, as well as some test refactoring for `Plug.BuilderTest`.

### Docs

- Better module docs, with examples on overriding `init/1` and `call/2` and a
more detailed description of the order of the plug pipeline.
- More detailed docs for the `plug/2` macro.
- More detailed docs for the `compile/3` function, mentioning guards and adding some examples.

### Code

- Extracted the `quote_plug_call/3` function which returns the quoted application of a plug based on its type (module plug or function plug), so that the main logic of `quote_plug` is never repeated (it was before, in both clauses of `quote_plug/2`).
- Renamed the `:call` atom used throughout the module to identify a module plug to `:module` in order to be consistent with `:fun` (that I actually renamed to `:function` for clarity :smile:).

Let me know if everything is ok or if I need to change something!