<commit_before>
//
//  SwiftAddressBookSource.swift
//  Pods
//
//  Created by Socialbit - <NAME> on 09.03.15.
//
//

import Foundation
import AddressBook

//MARK: Wrapper for ABAddressBookRecord of type ABSource

public class SwiftAddressBookSource : SwiftAddressBookRecord {

	public var sourceType : SwiftAddressBookSourceType {
		get {
			let sourceType : CFNumber = ABRecordCopyValue(internalRecord, kABSourceTypeProperty).takeRetainedValue() as CFNumber
			var rawSourceType : Int32? = nil
			CFNumberGetValue(sourceType, CFNumberGetType(sourceType), &rawSourceType)
			return SwiftAddressBookSourceType(abSourceType: rawSourceType!)
		}
	}

	public var searchable : Bool {
		get {
			let sourceType : CFNumber = ABRecordCopyValue(internalRecord, kABSourceTypeProperty).takeRetainedValue() as CFNumber
			var rawSourceType : Int32? = nil
			CFNumberGetValue(sourceType, CFNumberGetType(sourceType), &rawSourceType)
			let andResult = kABSourceTypeSearchableMask & rawSourceType!
			return andResult != 0
		}
	}

	public var sourceName : String? {
		get {
			let value: AnyObject? = ABRecordCopyValue(internalRecord, kABSourceNameProperty)?.takeRetainedValue()
			if value != nil {
				return value as CFString
			}
			else {
				return nil
			}
		}
	}
}<commit_msg>refactored and fixed bug in SwiftAddressBookSource (should fix #25)<commit_after>
//
//  SwiftAddressBookSource.swift
//  Pods
//
//  Created by Socialbit - <NAME> on 09.03.15.
//
//

import Foundation
import AddressBook

//MARK: Wrapper for ABAddressBookRecord of type ABSource

public class SwiftAddressBookSource : SwiftAddressBookRecord {

	public var sourceType : SwiftAddressBookSourceType {
		get {
			return SwiftAddressBookSourceType(abSourceType: internalSourceType)
		}
	}

	public var searchable : Bool {
		get {
			return (kABSourceTypeSearchableMask & internalSourceType) != 0
		}
	}

	private var internalSourceType : Int32 {
		get {
			let sourceType = ABRecordCopyValue(internalRecord, kABSourceTypeProperty)?.takeRetainedValue() as NSNumber
			return sourceType.intValue
		}
	}

	public var sourceName : String? {
		get {
			return ABRecordCopyValue(internalRecord, kABSourceNameProperty)?.takeRetainedValue() as? NSString
		}
	}
}
{'fraction_non_alphanumeric': 0.08378378378378379, 'fraction_numerical': 0.00990990990990991, 'mean_word_length': 4.3647342995169085, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2636108', 'n_tokens_mistral': 762, 'n_tokens_neox': 664, 'n_words': 164}