Permalink
Browse files

remove fun rec/1 in favor of '#is-record-'(Rec)

  • Loading branch information...
1 parent d2d290d commit b39b9b560a6f7be27f17595ccc80c90c45316933 Ali Yakamercan committed Dec 12, 2012
Showing with 3 additions and 21 deletions.
  1. +1 −1 src/json_rec.erl
  2. +1 −2 src/json_rec_model.erl
  3. +1 −18 src/json_rec_model.example
View
@@ -211,7 +211,7 @@ module_has_rec(Ms, Rec) ->
module_has_rec([],_Rec, throw) -> throw(did_not_find_module);
module_has_rec([],_Rec, V) -> V;
module_has_rec([M|T],Rec, Act) ->
- case M:rec(Rec) of
+ case M:'#is_record-'(Rec) of
false ->
module_has_rec(T,Rec, Act);
true ->
@@ -3,8 +3,7 @@
-export([behaviour_info/1]).
behaviour_info(callbacks) ->
- [{new,1},
- {rec,1}];
+ [{new,1}];
behaviour_info(_Other) ->
undefined.
@@ -21,8 +21,7 @@
%% the three functions required export
-export([
- new/1,
- rec/1
+ new/1
]).
%% define your record(s) that this module will work with
@@ -56,19 +55,3 @@ new(<<"fizzbuzz">>) ->
'#new-fizzbuzz'();
new(_) -> undefined.
-
-
-
-%% when json_rec is converting your data to json, it will try to
-%% determine if the tuple is a defined record. If it is, that
-%% information is used to build json dicts, otherwise the json becomes
-%% a json key:value.
-rec(#example{}) ->
- true;
-
-rec(#fizzbuzz{}) ->
- true;
-
-rec(_) ->
- false.
-

0 comments on commit b39b9b5

Please sign in to comment.