<commit_before>//
//  DistillSubscripted.swift
//  Alembic
//
//  Created by <NAME> on 3/29/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation

public struct DistillSubscripted {
    private let j: JSON
    private let path: JSONPath
    
    public subscript(path: JSONPathElement) -> DistillSubscripted {
        return .init(j, self.path + JSONPath(path))
    }
    
    public subscript(path: JSONPathElement...) -> DistillSubscripted {
        return .init(j, self.path + JSONPath(path))
    }
    
    init(_ j: JSON, _ path: JSONPath) {
        self.j = j
        self.path = path
    }    
}

public extension DistillSubscripted {
    func to<T: Distillable>(_: T.Type) throws -> T {
        return try distil()
    }
    
    func to<T: Distillable>(_: [T].Type) throws -> [T] {
        return try distil()
    }
    
    func to<T: Distillable>(_: [String: T].Type) throws -> [String: T] {<commit_msg>Change the DistillSubscripted from struct to class<commit_after>//
//  DistillSubscripted.swift
//  Alembic
//
//  Created by <NAME> on 3/29/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation

public final class DistillSubscripted {
    private let j: JSON
    private let path: JSONPath
    
    public subscript(path: JSONPathElement) -> DistillSubscripted {
        return .init(j, self.path + JSONPath(path))
    }
    
    public subscript(path: JSONPathElement...) -> DistillSubscripted {
        return .init(j, self.path + JSONPath(path))
    }
    
    init(_ j: JSON, _ path: JSONPath) {
        self.j = j
        self.path = path
    }    
}

public extension DistillSubscripted {
    func to<T: Distillable>(_: T.Type) throws -> T {
        return try distil()
    }
    
    func to<T: Distillable>(_: [T].Type) throws -> [T] {
        return try distil()
    }
    
    func to<T: Distillable>(_: [String: T].Type) throws -> [String: T] {
{'fraction_non_alphanumeric': 0.12852664576802508, 'fraction_numerical': 0.009404388714733543, 'mean_word_length': 2.3246527777777777, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 23, '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': '3615777', 'n_tokens_mistral': 652, 'n_tokens_neox': 629, 'n_words': 171}