-
-
Save havenwood/a9260df1c550a3da5e2905ea68340944 to your computer and use it in GitHub Desktop.
Ruby 2.5 Keyword Argument Struct
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Car = Struct.new :color, :doors, keyword_init: true | |
#=> Car(keyword_init: true) | |
car = Car.new color: 'Red', doors: 4 | |
#=> #<struct Car color="Red", doors=4> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment