<commit_before>package securatta.util

import static ratpack.jackson.Jackson.json

import ratpack.exec.Promise
import ratpack.func.Action
import ratpack.handling.Context

/**
 * Utilities for handlers
 *
 * @since 0.1.0
 */
class Handlers {

    /**
     * Renders the payload in case is present otherwise will use
     * the status passed as parameter to set the response HTTP status
     *
     * @param context Ratpack's context needed to render the result
     * @param status HTTP status code in case the param is not present
     * @return an instance of type {@link Action} that can be used in a handler's `then` clause
     * @since 0.1.0
     */
    static <T> Action<T> ifNotPresent(Context context, Integer status) {
        return { T param ->
            if (!param) {
                context.render(json(param))
            } else {
                context.response.status(status)
                context.render("")
            }<commit_msg>fix wrong condition<commit_after>package securatta.util

import static ratpack.jackson.Jackson.json

import ratpack.exec.Promise
import ratpack.func.Action
import ratpack.handling.Context

/**
 * Utilities for handlers
 *
 * @since 0.1.0
 */
class Handlers {

    /**
     * Renders the payload in case is present otherwise will use
     * the status passed as parameter to set the response HTTP status
     *
     * @param context Ratpack's context needed to render the result
     * @param status HTTP status code in case the param is not present
     * @return an instance of type {@link Action} that can be used in a handler's `then` clause
     * @since 0.1.0
     */
    static <T> Action<T> ifNotPresent(Context context, Integer status) {
        return { T param ->
            if (param) {
                context.render(json(param))
            } else {
                context.response.status(status)
                context.render("")
            }
{'fraction_non_alphanumeric': 0.08511749347258486, 'fraction_numerical': 0.006266318537859008, 'mean_word_length': 2.332173913043478, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '3098896', 'n_tokens_mistral': 527, 'n_tokens_neox': 501, 'n_words': 190}