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,14 @@
-spec decoder(Handler::module(), State::any(), Opts::jsx:opts()) -> jsx:decoder().
decoder(Handler, State, Opts) ->
fun(JSON) -> value(JSON, {Handler, State}, [], jsx_utils:parse_opts(Opts)) end.
fun(JSON) ->
value(
JSON,
{Handler, Handler:init(State)},
[],
jsx_utils:parse_opts(Opts)
)
end.