From 6c54fb707045418e728211dd4da17e8854657381 Mon Sep 17 00:00:00 2001 From: Mircea Ilie Ploscaru Date: Fri, 7 Jul 2017 21:22:15 +0200 Subject: [PATCH] all examples now run on v0.23 --- channel-select/channel-select.cr | 2 +- def/def.cr | 2 +- json/json.cr | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/channel-select/channel-select.cr b/channel-select/channel-select.cr index 696dcb3..082889d 100644 --- a/channel-select/channel-select.cr +++ b/channel-select/channel-select.cr @@ -1,4 +1,4 @@ -def generator(n : T) +def generator(n : T) forall T channel = Channel(T).new spawn do loop do diff --git a/def/def.cr b/def/def.cr index 90b39a5..ff193f0 100644 --- a/def/def.cr +++ b/def/def.cr @@ -19,7 +19,7 @@ def foo(x, y : Int32 = 1, z : Int64 = 2) x + y + z end -def foo(x : T) +def foo(x : T) forall T end foo(3) # x = 3, T = Int32 diff --git a/json/json.cr b/json/json.cr index 4637a0f..9cb3aaf 100644 --- a/json/json.cr +++ b/json/json.cr @@ -10,16 +10,16 @@ puts Hash{"apple" => 5, "lettuce" => 7}.to_json # json_object # json_array # field -result = String.build do |io| - io.json_object do |object| - object.field "address", "Crystal Road 1234" - object.field "location" do - io.json_array do |array| - array << 12.3 - array << 34.5 +result = JSON.build do |json| + json.object do + json.field "address", "Crystal Road 1234" + json.field "location" do + json.array do + json.number 12.3 + json.number 34.5 end end - end + end end puts result # => %({"address":"Crystal Road 1234","location":[12.3,34.5]})