<commit_before>-module(action_wire).
-author('<NAME>').
-include_lib("n2o/include/wf.hrl").
-compile(export_all).

% We have set of events that we wire them

render_action(#wire{actions=Api=#api{}}) -> action_api:render_action(Api);
render_action(#wire{actions=Redirect=#redirect{}}) -> action_redirect:render_action(Redirect);
render_action(#wire{actions=Event=#event{}}) -> action_event:render_action(Event);
render_action(#wire{actions=Script=#script{}}) -> action_script:render_action(Script);
render_action(#wire{actions=Actions}) -> Actions;
render_action(S) when is_list(S) -> S;
render_action(_) -> [].

wire(_, _, undefined) -> ok;
wire(_, _, []) -> ok;
wire(Trigger, Target, Actions) when is_binary(Actions) orelse ?IS_STRING(Actions) ->
    wire(Trigger, Target, #script { script=Actions });
wire(Trigger, Target, Actions) -> wf_context:add_action(#wire{ trigger=Trigger, target=Target, actions=Actions }).
<commit_msg>fix rendering #control{} action<commit_after>-module(action_wire).
-author('<NAME>').
-include_lib("n2o/include/wf.hrl").
-compile(export_all).

% We have set of events that we wire them

render_action(#wire{actions=Api=#api{}}) -> action_api:render_action(Api);
render_action(#wire{actions=Redirect=#redirect{}}) -> action_redirect:render_action(Redirect);
render_action(#wire{actions=Event=#event{}}) -> action_event:render_action(Event);
render_action(#wire{actions=Event=#control{}}) -> action_control:render_action(Event);
render_action(#wire{actions=Script=#script{}}) -> action_script:render_action(Script);
render_action(#wire{actions=Actions}) -> Actions;
render_action(S) when is_list(S) -> S;
render_action(_) -> [].

wire(_, _, undefined) -> ok;
wire(_, _, []) -> ok;
wire(Trigger, Target, Actions) when is_binary(Actions) orelse ?IS_STRING(Actions) ->
    wire(Trigger, Target, #script { script=Actions });
wire(Trigger, Target, Actions) -> wf_context:add_action(#wire{ trigger=Trigger, target=Target, actions=Actions }).

{'fraction_non_alphanumeric': 0.1826972010178117, 'fraction_numerical': 0.0010178117048346056, 'mean_word_length': 8.361904761904762, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2200111', 'n_tokens_mistral': 655, 'n_tokens_neox': 622, 'n_words': 107}