Skip to content

Instantly share code, notes, and snippets.

@jacksonpires
Created September 21, 2016 10:48
Show Gist options
  • Save jacksonpires/1f825203ed3a5990ff1dcb9eb1720ed4 to your computer and use it in GitHub Desktop.
Save jacksonpires/1f825203ed3a5990ff1dcb9eb1720ed4 to your computer and use it in GitHub Desktop.
Usando Struct com Ruby
Customer = Struct.new(:name, :address, :zip)
customers = []
customers.push(Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345))
customers.push(Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345))
customers.push(Customer.new("Jane Doe", "456 Elm, Anytown NC", 12345))
customers.each do |customer|
puts customer.name
puts customer.address
puts customer.zip
puts "---------------------"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment