Skip to content

Instantly share code, notes, and snippets.

@havenwood

havenwood/car.rb Secret

Created December 28, 2017 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save havenwood/a9260df1c550a3da5e2905ea68340944 to your computer and use it in GitHub Desktop.
Save havenwood/a9260df1c550a3da5e2905ea68340944 to your computer and use it in GitHub Desktop.
Ruby 2.5 Keyword Argument Struct
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