OSDN Git Service

APIResponseのENABLE_JSON_LOG部分を移動
authormasakih <masakih@users.sourceforge.jp>
Sun, 12 Mar 2017 15:27:20 +0000 (00:27 +0900)
committermasakih <masakih@users.sourceforge.jp>
Sun, 12 Mar 2017 15:27:20 +0000 (00:27 +0900)
JSONViewCommandにENABLE_JSON_LOGを集約

KCD/APIResponse.swift
KCD/JSONViewCommand.swift

index e27e968..9bfcdf6 100644 (file)
@@ -59,10 +59,6 @@ struct APIResponse {
         return false
     }
     
-    #if ENABLE_JSON_LOG
-    let argumentArray: [[String: String]]
-    #endif
-    
     init?(request: URLRequest, data: Data) {
         date = Date()
         
@@ -86,11 +82,5 @@ struct APIResponse {
                 return nil
         }
         self.api = api
-        
-        #if ENABLE_JSON_LOG
-            argumentArray = parameter.map { (key, value) in
-                ["key": key, "value": value]
-            }
-        #endif
     }
 }
index 6e2cd35..173418d 100644 (file)
@@ -18,7 +18,9 @@ class JSONViewCommand: JSONCommand {
     
     init(apiResponse: APIResponse, command: JSONCommand) {
         self.recieveDate = Date()
-        self.parameterList = apiResponse.argumentArray
+        self.parameterList = apiResponse
+            .parameter
+            .map { ["key": $0.0, "value": $0.1] }
         self.jsonTree = JSONNode
             .nodeWithJSON(apiResponse.json as AnyObject?)
             .map { [$0] }