<commit_before>//
//  MaterialDesignSymbol
//
//  Created by tichise on 2015/5/7 15/05/07.
//  Copyright (c) 2015 tichise. All rights reserved.
//

import UIKit

/**
 * MaterialDesignSymbolのメインクラス
 */
open class MaterialDesignSymbol {

    var text = ""

    var mutableTextFontAttributes = [NSAttributedString.Key: Any]()

    public init(text: String, size: CGFloat) {
        self.text = text

        self.mutableTextFontAttributes = [NSAttributedString.Key: Any]()
        
        if let paragraphStyle = NSMutableParagraphStyle.default.mutableCopy() as? NSMutableParagraphStyle {
            self.mutableTextFontAttributes[NSAttributedString.Key.paragraphStyle] = paragraphStyle
        }

        self.mutableTextFontAttributes[NSAttributedString.Key.font] = MaterialDesignFont.fontOfSize(size)
    }

    // MARK: - Method
    public func addAttribute(attributeName: NSAttributedString.Key, value: Any) {
        self.mutableTextFontAttributes[attributeName] = value
    }

    /**
     // アイコンを画像形式で取得するのに使うメソッド
     - parameter size: サイズ
     - returns: UIImage
     */
    public func image(size: CGSize) -> UIImage {
        UIGraphicsBeginImageContextWithOptions(size, false, 0)

        let textRect  = CGRect(x: 0, y: 0, width: size.width, height: size.height)
        self.text.draw(in: textRect, withAttributes: self.mutableTextFontAttributes)

        let image = UIGraphicsGetImageFromCurrentImageContext()

        UIGraphicsEndImageContext()

        return image!
    }
}
<commit_msg>change to public<commit_after>//
//  MaterialDesignSymbol
//
//  Created by tichise on 2015/5/7 15/05/07.
//  Copyright (c) 2015 tichise. All rights reserved.
//

import UIKit

/**
 * MaterialDesignSymbolのメインクラス
 */
public class MaterialDesignSymbol {

    var text = ""

    var mutableTextFontAttributes = [NSAttributedString.Key: Any]()

    public init(text: String, size: CGFloat) {
        self.text = text

        self.mutableTextFontAttributes = [NSAttributedString.Key: Any]()
        
        if let paragraphStyle = NSMutableParagraphStyle.default.mutableCopy() as? NSMutableParagraphStyle {
            self.mutableTextFontAttributes[NSAttributedString.Key.paragraphStyle] = paragraphStyle
        }

        self.mutableTextFontAttributes[NSAttributedString.Key.font] = MaterialDesignFont.fontOfSize(size)
    }

    // MARK: - Method
    public func addAttribute(attributeName: NSAttributedString.Key, value: Any) {
        self.mutableTextFontAttributes[attributeName] = value
    }

    /**
     // アイコンを画像形式で取得するのに使うメソッド
     - parameter size: サイズ
     - returns: UIImage
     */
    public func image(size: CGSize) -> UIImage {
        UIGraphicsBeginImageContextWithOptions(size, false, 0)

        let textRect  = CGRect(x: 0, y: 0, width: size.width, height: size.height)
        self.text.draw(in: textRect, withAttributes: self.mutableTextFontAttributes)

        let image = UIGraphicsGetImageFromCurrentImageContext()

        UIGraphicsEndImageContext()

        return image!
    }
}

{'fraction_non_alphanumeric': 0.0967207684663796, 'fraction_numerical': 0.012586949320967208, 'mean_word_length': 3.01062416998672, 'pattern_counts': {'":': 0, '<': 3, '<?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': '800215', 'n_tokens_mistral': 991, 'n_tokens_neox': 934, 'n_words': 184}