<commit_before>//
//  ViewInitializer.swift
//  Visuality
//
//  Created by <NAME> on 30.10.2017.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import UIKit

internal class ViewInitializer<View: UIView> {
    
    // MARK: Class variables & properties
    
    // MARK: Public class methods
    
    // MARK: Private class methods
    
    // MARK: Initializers
    
    public init(viewClass: View.Type) {
    }
    
    // MARK: Deinitializer
    
    deinit {
    }
    
    // MARK: Object variables & properties
    
    // MARK: Public object methods
    
    /**
     Creates new instance of view.
     
     - Parameters:
         - nibQuery: Nib query.
         - bundleQuery: Bundle query.
     
     - returns: View from specified location.
     */
    public func view(fromNib nibQuery: NibQuery, locatedInBundle bundleQuery: BundleQuery) -> View {
        // Obtain bundle
        
        var nibBundle: Bundle!
        
        switch bundleQuery {
        case .main:
            nibBundle = .main
            break
        case let .byValue(bundle):
            nibBundle = bundle
            break
        case let .byIdentifier(identifier):
            nibBundle = Bundle(identifier: identifier)
            break
        }
        
        let bundleOrMain = nibBundle ?? .main
        
        // Obtain nib name
        
        var nibName: String?
        
        switch nibQuery {
        case let .byNibName(name):
            nibName = name
            break
        case .byClassName:
            nibName = View.vt_classNameWithoutNamespace()
        case .byClassNameWithSuffix(let suffix):
            nibName = String(
                format: "%@%@",
                View.vt_classNameWithoutNamespace(),
                suffix.string
            )
            break
        case .none:
            // Do nothing
            break
        }<commit_msg>Use ClassFormatter in ViewInitializer<commit_after>//
//  ViewInitializer.swift
//  Visuality
//
//  Created by <NAME> on 30.10.2017.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import UIKit

internal class ViewInitializer<View: UIView> {
    
    // MARK: Class variables & properties
    
    // MARK: Public class methods
    
    // MARK: Private class methods
    
    // MARK: Initializers
    
    public init(viewClass: View.Type) {
    }
    
    // MARK: Deinitializer
    
    deinit {
    }
    
    // MARK: Object variables & properties
    
    // MARK: Public object methods
    
    /**
     Creates new instance of view.
     
     - Parameters:
         - nibQuery: Nib query.
         - bundleQuery: Bundle query.
     
     - returns: View from specified location.
     */
    public func view(fromNib nibQuery: NibQuery, locatedInBundle bundleQuery: BundleQuery) -> View {
        // Obtain bundle
        
        var nibBundle: Bundle!
        
        switch bundleQuery {
        case .main:
            nibBundle = .main
            break
        case let .byValue(bundle):
            nibBundle = bundle
            break
        case let .byIdentifier(identifier):
            nibBundle = Bundle(identifier: identifier)
            break
        }
        
        let bundleOrMain = nibBundle ?? .main
        
        // Obtain nib name
        
        var nibName: String?
        
        switch nibQuery {
        case let .byNibName(name):
            nibName = name
            break
        case .byClassName:
            nibName = ClassFormatter(type: View.self).classNameWithoutNamespace()
            break
        case .byClassNameWithSuffix(let suffix):
            nibName = String(
                format: "%@%@",
                ClassFormatter(type: View.self).classNameWithoutNamespace(),
                suffix.string
            )
            break
        case .none:
            // Do nothing
            break
        }
{'fraction_non_alphanumeric': 0.08264462809917356, 'fraction_numerical': 0.006198347107438017, 'mean_word_length': 1.389265885256015, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '6029582', 'n_tokens_mistral': 1074, 'n_tokens_neox': 1014, 'n_words': 278}