<commit_before>//
//  RBSTools.swift
//  Pods
//
//  Created by <NAME> on 03/05/2017.
//
//

import RealmSwift
import AVFoundation

public struct RBSRequestConfig {
    public let header: [String:Any]?
    public let body: [String:Any]?
}

final class RBSTools {
    
    private static let localVersion = "v0.2.3"
    
    class func stringForProperty(_ property: Property, object: Object) -> String {
        var propertyValue = ""
        if property.isArray {
            let array = object.dynamicList(property.name)
            propertyValue = String.localizedStringWithFormat("%li objects  ->", array.count)
        
        }else {
            switch property.type {
            case .bool:
                if object[property.name] as! Bool == false {
                    propertyValue = "false"
                } else {
                    propertyValue = "true"
                }
                break
            case .int, .float, .double:
                propertyValue = String(describing: object[property.name] as! NSNumber)
                break
            case .string:
                propertyValue = object[property.name] as! String
                break
            case .object:
                guard let objAsProperty = object[property.name] else {
                    return ""
                }
                let obj = objAsProperty as! Object
                let schema = obj.objectSchema
                for prop in schema.properties {
                    if prop.type == .string {
                        propertyValue = obj[prop.name] as! String
                    }
                    break
                }<commit_msg>update tools to include linking Objects<commit_after>//
//  RBSTools.swift
//  Pods
//
//  Created by <NAME> on 03/05/2017.
//
//

import RealmSwift
import AVFoundation

public struct RBSRequestConfig {
    public let header: [String:Any]?
    public let body: [String:Any]?
}

final class RBSTools {
    
    private static let localVersion = "v0.2.5"
    
    class func stringForProperty(_ property: Property, object: Object) -> String {
        var propertyValue = ""
        if property.isArray || property.type == .linkingObjects {
            let array = object.dynamicList(property.name)
            propertyValue = String.localizedStringWithFormat("%li objects  ->", array.count)
        
        }else {
            switch property.type {
            case .bool:
                if object[property.name] as! Bool == false {
                    propertyValue = "false"
                } else {
                    propertyValue = "true"
                }
                break
            case .int, .float, .double:
                propertyValue = String(describing: object[property.name] as! NSNumber)
                break
            case .string:
                propertyValue = object[property.name] as! String
                break
            case .object:
                if let objAsProperty:Object = object[property.name] as? Object {
                    let schema = objAsProperty.objectSchema
                    _ = schema.properties.map{ $0.type == .string }
//                    for prop in  {
//                        if prop.type == .string {
//                            propertyValue = obj[prop.name] as! String
//                        }
//                }
                    break
                }
{'fraction_non_alphanumeric': 0.09002361275088548, 'fraction_numerical': 0.00678866587957497, 'mean_word_length': 1.332415691672402, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3680433', 'n_tokens_mistral': 888, 'n_tokens_neox': 821, 'n_words': 226}