<commit_before>// Part of FoundationKit http://foundationk.it

#define FKSynthesizeSingletonForClass(classname) \
\
static classname *shared##classname = nil; \
\
+ (classname *)shared##classname \
{ \
static dispatch_once_t pred; \
dispatch_once(&pred, ^{ shared##classname = [[self alloc] init]; }); \
return shared##classname; \
}<commit_msg>New block-based method for defining a singleton<commit_after>// Part of FoundationKit http://foundationk.it
//
// FKDefineSingletonUsingBlock derived from lukeredpath's gist: https://gist.github.com/1057420

#define FKSynthesizeSingletonForClass(classname) \
\
static classname *shared##classname = nil; \
\
+ (classname *)shared##classname \
{ \
static dispatch_once_t pred; \
dispatch_once(&pred, ^{ shared##classname = [[self alloc] init]; }); \
return shared##classname; \
}


// Use like this:
// + (id)sharedInstance {
//  FKDefineSingletonUsingBlock(^{
//    return [[self alloc] init];
//  });
// }

#define FKDefineSingletonUsingBlock(block) \
static dispatch_once_t pred; \
__strong static id sharedObject_ = nil; \
dispatch_once(&pred, ^{ sharedObject_ = block(); }); \
return _sharedObject; \
{'fraction_non_alphanumeric': 0.1514360313315927, 'fraction_numerical': 0.006092254134029591, 'mean_word_length': 4.778894472361809, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, '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': '6863804', 'n_tokens_mistral': 379, 'n_tokens_neox': 360, 'n_words': 82}