<commit_before>//
//  ServiceTask+Brew.swift
//  ELWebServiceExample
//
//  Created by <NAME> on 9/30/15.
//  Copyright © 2015 WalmartLabs. All rights reserved.
//

import Foundation
import ELWebService

//extension ServiceTask {
//    
//    func responseAsBrews(_ handler: @escaping ([Brew]) -> Void) -> Self {
//        return
//            responseJSON { json, response in
//                if let json = self.jsonObject(json, forKey: "brews"),
//                    let jsonArray = json as? [Any],
//                    let decodedArray = ModelDecoder<Brew>.decodeArray(jsonArray) {
//                        return .Value(decodedArray)
//                } else {
//                    return .Failure(ServiceTaskDecodeError.FailedToDecodeJSONArray)
//                }
//            }
//            .updateUI { value in
//                if let brews = value as? [Brew] {
//                    handler(brews)
//                }
//            }
//    }
//}
extension ServiceTask {
    func responseAsBrews(_ handler: @escaping ([Brew]) -> Void) -> Self {
        return
            responseJSON { json, response in
                guard
                    let dictionary = json["brews"],
                    let jsonArray = dictionary as? [Any],
                    let decodedArray = ModelDecoder<Brew>.decodeArray(jsonArray)
                    else {
                        throw ServiceTaskDecodeError.failedToDecodeJSONArray
                }
                
                return .value(decodedArray)
                }
                .updateUI { value in
                    if let brews = value as? [Brew] {
                        handler(brews)
                    }
        }
    }
}<commit_msg>remove commented-out code in example project<commit_after>//
//  ServiceTask+Brew.swift
//  ELWebServiceExample
//
//  Created by <NAME> on 9/30/15.
//  Copyright © 2015 WalmartLabs. All rights reserved.
//

import Foundation
import ELWebService

extension ServiceTask {
    func responseAsBrews(_ handler: @escaping ([Brew]) -> Void) -> Self {
        return
            responseJSON { json, response in
                guard
                    let dictionary = json["brews"],
                    let jsonArray = dictionary as? [Any],
                    let decodedArray = ModelDecoder<Brew>.decodeArray(jsonArray)
                    else {
                        throw ServiceTaskDecodeError.failedToDecodeJSONArray
                }
                
                return .value(decodedArray)
                }
                .updateUI { value in
                    if let brews = value as? [Brew] {
                        handler(brews)
                    }
        }
    }
}
{'fraction_non_alphanumeric': 0.09689349112426035, 'fraction_numerical': 0.006656804733727811, 'mean_word_length': 1.2485453034081464, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 14, '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': '6440320', 'n_tokens_mistral': 725, 'n_tokens_neox': 657, 'n_words': 168}