This blog is part of our Ruby 2.5 series.
In Ruby, structs can be created using positional arguments.
This approach works when the arguments list is short. When arguments list increases then it gets harder to track which position maps to which value.
Here if we pass keyword argument then we won’t get any error. But the values are not what we wanted.
However this introduces a problem.
How do we indicate to
we want to pass arguments using position or keywords.
keyword_argument as an identifier.
to change the name to
So in Ruby 2.5 we can create structs using keywords as long as we