OSDN Git Service

guard の書き方を統一した
[kcd/KCD.git] / KCD / IgnoreCommand.swift
1 //
2 //  IgnoreCommand.swift
3 //  KCD
4 //
5 //  Created by Hori,Masaki on 2017/01/08.
6 //  Copyright © 2017年 Hori,Masaki. All rights reserved.
7 //
8
9 import Cocoa
10
11 final class IgnoreCommand: JSONCommand {
12     
13     private static let ignores: [String] = {
14         
15         guard let url = Bundle.main.url(forResource: "IgnoreCommand", withExtension: "plist"),
16             let array = NSArray(contentsOf: url) as? [String] else {
17                 
18                 fatalError("Can not read IgnoreCommand.plist")
19         }
20         
21         return array
22     }()
23     
24     override class func canExecuteAPI(_ api: String) -> Bool {
25         
26         if ignores.contains(api) { return true }
27         if api.hasPrefix("/kcsapi/api_req_ranking/") { return true }
28         
29         return false
30     }
31     
32     override func execute() {
33         
34         // do nothing
35     }
36 }