<commit_before>//
//  Errors.swift
//  SQLite
//
//  Created by <NAME> on 5/12/16.
//
//

public enum Error: ErrorType {
    case Blank
    case Absent
    case TooShort(length: Int)
    case TooLong(length: Int)
    case WrongLength(length: Int)
    case Taken
    case Invalid
    
    case NotANumber
    
    var rawValue: String {
        switch self {
        case Blank: return "blank"
        case Absent: return "present"
        case TooShort: return "too_short"
        case TooLong: return "too_long"
        case WrongLength: return "wrong_length"
        case Taken: return"taken"
        case Invalid: return "invalid"
            
        case NotANumber: return "not_a_number"
        default: return "empty_error"
        }
    }
}

public struct Errors {
    
    var model: ActiveRecord
    
    var attributes = Dictionary<String, Error>()
    public mutating func add(attribute: String, message: Error) {
        self.attributes[attribute] = message
        self._messages << (self.model.dynamicType.modelName + "." + message.rawValue)
    }
    private var _messages = Array<String>()
    public var messages: [String] {
        return base + _messages
    }
    
    public var base = Array<String>()<commit_msg>Add equal errors.<commit_after>//
//  Errors.swift
//  SQLite
//
//  Created by <NAME> on 5/12/16.
//
//

public enum Error: ErrorType {
    case Blank
    case Absent
    case TooShort(length: Int)
    case TooLong(length: Int)
    case WrongLength(length: Int)
    case Taken
    case Invalid
    
    case NotANumber
    
    case LessThanOrEqual(value: AnyType)
    case LessThan(value: AnyType)
    case GreaterThanOrEqual(value: AnyType)
    case GreaterThan(value: AnyType)
    case EqualTo(value: AnyType)
    
    var rawValue: String {
        switch self {
        case Blank: return "blank"
        case Absent: return "present"
        case TooShort: return "too_short"
        case TooLong: return "too_long"
        case WrongLength: return "wrong_length"
        case Taken: return"taken"
        case Invalid: return "invalid"
            
        case NotANumber: return "not_a_number"
            
        case LessThanOrEqual: return "less_than_or_equal_to"
        case LessThan: return "less_than"
        case GreaterThanOrEqual: return "greater_than"
        case GreaterThan: return "greater_than_or_equal_to"
        case EqualTo: return "equal_to"
            
        default: return "empty_error"
        }
    }
}

public struct Errors {
    
    var model: ActiveRecord
    
    var attributes = Dictionary<String, Error>()
    public mutating func add(attribute: String, message: Error) {
        self.attributes[attribute] = message
        self._messages << (self.model.dynamicType.modelName + "." + message.rawValue)
    }
    private var _messages = Array<String>()
    public var messages: [String] {
        return base + _messages
    }
    
    public var base = Array<String>()
{'fraction_non_alphanumeric': 0.0890318212593094, 'fraction_numerical': 0.003385240352064997, 'mean_word_length': 2.2906458797327396, 'pattern_counts': {'":': 0, '<': 15, '<?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': '4540050', 'n_tokens_mistral': 888, 'n_tokens_neox': 851, 'n_words': 250}