Customer = Struct.new(:name, :email, keyword_init: true)
Customer.new(name: "John", email: "john@example.com")
Customer = Struct.new(:name, :address) do
def greeting
"Hello #{name}!"
end
end
dave = Customer.new("Dave", "123 Main")
dave.name #=> "Dave"
dave.greeting #=> "Hello Dave!"