<commit_before>my enum FileChangeEvent (:FileChanged(1), :FileRenamed(2));

my class IO::Notification {
    my class FileWatchCancellation is repr('AsyncTask') { }

    class Change {
        has $.path;
        has $.event;
    }

    method watch_path(Str() $path, :$scheduler = $*SCHEDULER) {
        my $s = Supply.new;
        nqp::watchfile(
            $scheduler.queue,
            -> \path, \rename, \err {
                if err {
                    $s.quit(err);
                }
                else {
                    my $event = rename ?? FileRenamed !! FileChanged;
                    $s.emit(Change.new(:path(path // $path), :$event));
                }
            },
            $path, FileWatchCancellation);
        $s
    }
}
<commit_msg>Give IO::Notification::Change a gist method<commit_after>my enum FileChangeEvent (:FileChanged(1), :FileRenamed(2));

my class IO::Notification {
    my class FileWatchCancellation is repr('AsyncTask') { }

    class Change {
        has $.path;
        has $.event;
        multi method gist(Change:D:) {
            "$.path: $.event";
        }
    }

    method watch_path(Str() $path, :$scheduler = $*SCHEDULER) {
        my $s = Supply.new;
        nqp::watchfile(
            $scheduler.queue,
            -> \path, \rename, \err {
                if err {
                    $s.quit(err);
                }
                else {
                    my $event = rename ?? FileRenamed !! FileChanged;
                    $s.emit(Change.new(:path(path // $path), :$event));
                }
            },
            $path, FileWatchCancellation);
        $s
    }
}

{'fraction_non_alphanumeric': 0.1353658536585366, 'fraction_numerical': 0.0024390243902439024, 'mean_word_length': 1.4347181008902077, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1179245', 'n_tokens_mistral': 506, 'n_tokens_neox': 473, 'n_words': 103}