Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
customer = Customer.new("Mr", "Jason", "Gorman")
writer = ResponseWriter.new
writer.write(customer, method(:to_html), lambda {|o| ConsoleWriter.new().write_console(o)})
writer.write(customer, method(:to_xml), lambda {|o| LogFileWriter.new("C:\test\testlog.txt").write_logfile(o)})
writer.write(customer, method(:to_string), lambda {|o| NoSqlWriter.new(
"mongodb",
"localhost",
"admin",
"password123").write_nosql(o)})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment