Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Commit

Permalink
Pimp examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Jonas committed Jan 27, 2014
1 parent 9c2608e commit ee902f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 5 additions & 2 deletions examples/apps/records/src/records.erl
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
-module(records).

-export([
start/0
start/0, sum_hours/1
]).

-json({person, ["name", {list, "subjects"}, "creditPoints"]}).
-json({subject, ["name", {proplist, "meta"}, "credit"]}).
-json({subject, ["name", {proplist, "meta"}, "credit",
{pre, "sumHours", {records, sum_hours}}]}).

start() ->
S1 = {subject, "Maths", [{lecture, 2}, {lab, 3}, {essay, 2}], 5},
Expand All @@ -14,3 +15,5 @@ start() ->

io:format("~s~n", [ejson:to_json_module(P, ?MODULE)]).

sum_hours(_List) ->
0.
4 changes: 1 addition & 3 deletions examples/rebar.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

{erl_opts, [debug_info]}.

{lib_dirs, [".."]}.
{erl_opts, [debug_info, {parse_transform, ejson_trans}]}.

{sub_dirs, [
"apps/records"
Expand Down

0 comments on commit ee902f6

Please sign in to comment.