<commit_before>//
//  Rule.swift
//  pblock
//
//  Created by <NAME> on 7/10/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import Foundation
import CoreData


@objc(Rule)
class Rule: NSManagedObject {

  var actionType : RuleActionType {
    get {
      if nil == actionTypeRaw {
        return RuleActionType.Invalid
      } else {
        let rawVal = actionTypeRaw!.shortValue
        if let enumVal = RuleActionType(rawValue: rawVal) {
          return enumVal
        } else {
          return RuleActionType.Invalid
        }
      }
    }
    set(newValue) {
      actionTypeRaw = NSNumber(short: newValue.rawValue)
    }
  }

  /**
  NB: this is a bit tricky in that you can mutuate the options values, but then the set logic
  won't get triggered, so the coredata serialized value won't be updated. So, for now, never mutate<commit_msg>whitespace<commit_after>//
//  Rule.swift
//  pblock
//
//  Created by <NAME> on 7/10/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import Foundation
import CoreData

@objc(Rule)
class Rule: NSManagedObject {

  var actionType : RuleActionType {
    get {
      if nil == actionTypeRaw {
        return RuleActionType.Invalid
      } else {
        let rawVal = actionTypeRaw!.shortValue
        if let enumVal = RuleActionType(rawValue: rawVal) {
          return enumVal
        } else {
          return RuleActionType.Invalid
        }
      }
    }
    set(newValue) {
      actionTypeRaw = NSNumber(short: newValue.rawValue)
    }
  }

  /**
  NB: this is a bit tricky in that you can mutuate the options values, but then the set logic
  won't get triggered, so the coredata serialized value won't be updated. So, for now, never mutate
{'fraction_non_alphanumeric': 0.09005847953216374, 'fraction_numerical': 0.010526315789473684, 'mean_word_length': 2.341796875, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5490916', 'n_tokens_mistral': 540, 'n_tokens_neox': 510, 'n_words': 169}