From 53db8fb450a06d6eea8c7452a006b17bd9354c67 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Thu, 15 Dec 2022 11:53:32 -0800 Subject: [PATCH] Add Struct examples to NEWS [ci skip] --- NEWS.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/NEWS.md b/NEWS.md index c1856bc54b..bd163ee865 100644 --- a/NEWS.md +++ b/NEWS.md @@ -345,6 +345,16 @@ Note: We're only listing outstanding class updates. * A Struct class can also be initialized with keyword arguments without `keyword_init: true` on Struct.new [[Feature #16806]] + ```ruby + Post = Struct.new(:id, :name) + + # In addition to this, + Post.new(1, "hello") #=> # + + # Let the following initialization also work + Post.new(id: 1, name: "hello") #=> # + ``` + * Thread * Thread#each_caller_location is added. [[Feature #16663]]