Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def write(customer, serialize, write)
write.call(serialize.call(customer))
end
customer = Customer.new("Mr", "Jason", "Gorman")
write(customer, method(:to_html), method(:write_console))
write(customer, method(:to_xml), write_logfile("C:\test\testlog.txt"))
write(customer, method(:to_string), write_nosql("mongodb",
"localhost",
"admin",
"password123"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment