A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-27.rb
1Person=Struct.new(:name,:age,keyword_init:true)
2bob=Person.new(name:"Bob",age:30)
3putsbob.name
4putsbob.age
5putsbob.to_a.inspect
Classes
Answer & explanation
Console output
Bob
30
["Bob", 30]
Why
`keyword_init: true` makes the Struct constructor require keyword arguments, improving clarity at call sites. The internal storage and accessors work identically to positional Structs. `to_a` returns values in the order the fields were declared.