<commit_before>//
//  PropertyPolicy.swift
//  KakapoExample
//
//  Created by <NAME> on 31/03/16.
//  Copyright © 2016 devlucky. All rights reserved.
//

import Foundation

public protocol _PropertyPolicy: Serializable {
    var _object: Any { get }
    var shouldSerialize: Bool { get }
}

public protocol PropertyPolicy: _PropertyPolicy {
    associatedtype T
    var object: T? { get }
    var shouldSerialize: Bool { get }
}

extension PropertyPolicy {
    public var _object: Any {
        get {
            return object
        }
    }
}

public struct IgnorableNilProperty<T>: PropertyPolicy {
    public let object: T?
    
    init(_ object: T?) {
        self.object = object
    }
    
    public var shouldSerialize: Bool {
        return object != nil
    }
}
<commit_msg>swift <2.2 compatibility<commit_after>//
//  PropertyPolicy.swift
//  KakapoExample
//
//  Created by <NAME> on 31/03/16.
//  Copyright © 2016 devlucky. All rights reserved.
//

import Foundation

public protocol _PropertyPolicy: Serializable {
    var _object: Any { get }
    var shouldSerialize: Bool { get }
}

public protocol PropertyPolicy: _PropertyPolicy {
    typealias T
    var object: T? { get }
    var shouldSerialize: Bool { get }
}

extension PropertyPolicy {
    public var _object: Any {
        get {
            return object
        }
    }
}

public struct IgnorableNilProperty<T>: PropertyPolicy {
    public let object: T?
    
    init(_ object: T?) {
        self.object = object
    }
    
    public var shouldSerialize: Bool {
        return object != nil
    }
}

{'fraction_non_alphanumeric': 0.09240506329113925, 'fraction_numerical': 0.013924050632911392, 'mean_word_length': 2.3214285714285716, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 7, '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': '1331566', 'n_tokens_mistral': 489, 'n_tokens_neox': 467, 'n_words': 146}