From 99d329d0bcb394577f1dc4ea4c53d18d5309275c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20Laferri=C3=A8re?= Date: Wed, 14 Sep 2016 16:09:07 -0400 Subject: [PATCH] refund & nitrpg: rename 2 conflictual to_json to to_json_object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- contrib/nitrpg/src/achievements.nit | 2 +- contrib/nitrpg/src/events.nit | 2 +- contrib/nitrpg/src/game.nit | 6 +++--- contrib/nitrpg/src/statistics.nit | 2 +- contrib/refund/src/refund_json.nit | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/contrib/nitrpg/src/achievements.nit b/contrib/nitrpg/src/achievements.nit index 9055b22876..1f1d331ee6 100644 --- a/contrib/nitrpg/src/achievements.nit +++ b/contrib/nitrpg/src/achievements.nit @@ -120,7 +120,7 @@ class Achievement json["reward"].as(Int)) end - redef fun to_json do + redef fun to_json_object do do var json = super json["id"] = id json["name"] = name diff --git a/contrib/nitrpg/src/events.nit b/contrib/nitrpg/src/events.nit index c540dc5e91..c21febf5fd 100644 --- a/contrib/nitrpg/src/events.nit +++ b/contrib/nitrpg/src/events.nit @@ -104,7 +104,7 @@ class GameEvent time = new ISODate.from_string(json["time"].as(String)) end - redef fun to_json do + redef fun to_json_object do do var json = new JsonObject json["internal_id"] = internal_id.to_s json["kind"] = kind diff --git a/contrib/nitrpg/src/game.nit b/contrib/nitrpg/src/game.nit index 504c445881..ed411c0c8a 100644 --- a/contrib/nitrpg/src/game.nit +++ b/contrib/nitrpg/src/game.nit @@ -45,7 +45,7 @@ interface GameEntity fun save do game.db.collection(collection_name).save(to_json) # Json representation of `self`. - fun to_json: JsonObject do + fun to_json_object do: JsonObject do var json = new JsonObject json["_id"] = key return json @@ -102,7 +102,7 @@ class Game # Used to load entities from saved data. fun from_json(json: JsonObject) do end - redef fun to_json do + redef fun to_json_object do do var json = super json["name"] = name return json @@ -236,7 +236,7 @@ class Player nitcoins = json["nitcoins"].as(Int) end - redef fun to_json do + redef fun to_json_object do do var json = super json["game"] = game.key json["name"] = name diff --git a/contrib/nitrpg/src/statistics.nit b/contrib/nitrpg/src/statistics.nit index cde68161b5..6e6f63bf1b 100644 --- a/contrib/nitrpg/src/statistics.nit +++ b/contrib/nitrpg/src/statistics.nit @@ -172,7 +172,7 @@ class GameStats for k, v in values do self[k] = v.as(Int) end - redef fun to_json do + redef fun to_json_object do do var obj = super obj["period"] = period obj["owner"] = owner.key diff --git a/contrib/refund/src/refund_json.nit b/contrib/refund/src/refund_json.nit index bf35a4cce7..a049b5d9bc 100644 --- a/contrib/refund/src/refund_json.nit +++ b/contrib/refund/src/refund_json.nit @@ -119,7 +119,7 @@ redef class RefundProcessor exit 1 end - redef fun show_stats do print load_stats.to_json.to_pretty_json + redef fun show_stats do print load_stats.to_json_object.to_pretty_json redef fun load_stats do # If no stats found, return a new object @@ -135,7 +135,7 @@ redef class RefundProcessor end redef fun save_stats(stats) do - write_output(stats.to_json.to_pretty_json, stats_file) + write_output(stats.to_json_object.to_pretty_json, stats_file) end end @@ -147,7 +147,7 @@ redef class RefundStats end # Outputs `self` as a JSON string. - fun to_json: JsonObject do + fun to_json_object: JsonObject do var obj = new JsonObject for k, v in self do obj[k] = v return obj