Created
October 8, 2017 17:21
-
-
Save rohitpaulk/ef148c926a1205b624f443e454c98a82 to your computer and use it in GitHub Desktop.
Ruby's 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
# Create a new class from Struct | |
Customer = Struct.new(:name, :address) | |
#=> Customer | |
Customer.new("Dave", "123 Main") | |
#=> #<struct Customer name="Dave", address="123 Main"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment