OSDN Git Service

799cb9edf49969f5edc637e6dc3734b770f97bca
[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: API) -> Bool {
25         
26         if api.includs(in: ignores) {
27             
28             return true
29         }
30         if api.isRanking() {
31             
32             return true
33         }
34         
35         return false
36     }
37     
38     override func execute() {
39         
40         // do nothing
41     }
42 }