Skip to content

Commit

Permalink
refund & nitrpg: rename 2 conflictual to_json to to_json_object
Browse files Browse the repository at this point in the history
Signed-off-by: Alexis Laferrière <[email protected]>
  • Loading branch information
xymus committed Sep 14, 2016
1 parent 75ebbf2 commit 99d329d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion contrib/nitrpg/src/achievements.nit
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion contrib/nitrpg/src/events.nit
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions contrib/nitrpg/src/game.nit
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion contrib/nitrpg/src/statistics.nit
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions contrib/refund/src/refund_json.nit
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 99d329d

Please sign in to comment.