lift init methods into decoder/encoder

This commit is contained in:
alisdair sullivan 2012-03-05 19:53:55 -08:00
parent 90520b9c0c
commit d654a0e882
5 changed files with 20 additions and 7 deletions

View file

@ -29,7 +29,13 @@
-spec encoder(Handler::module(), State::any(), Opts::jsx:opts()) -> jsx:encoder().
encoder(Handler, State, Opts) ->
fun(JSON) -> start(JSON, {Handler, State}, jsx_utils:parse_opts(Opts)) end.
fun(JSON) ->
start(
JSON,
{Handler, Handler:init(State)},
jsx_utils:parse_opts(Opts)
)
end.