Skip to content

Instantly share code, notes, and snippets.

@jasongorman
Created March 23, 2019 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasongorman/3ba3bc91281c84e53b189c7fc91b87c5 to your computer and use it in GitHub Desktop.
Save jasongorman/3ba3bc91281c84e53b189c7fc91b87c5 to your computer and use it in GitHub Desktop.
customer = Customer.new("Mr", "Jason", "Gorman")
writer = ResponseWriter.new
writer.write(customer, lambda {|c| HtmlSerializer.new().to_html(c)}, ConsoleWriter.new)
writer.write(customer, lambda {|c| XmlSerializer.new().to_xml(c)}, LogFileWriter.new("C:\test\testlog.txt"))
writer.write(customer, lambda {|c| StringSerializer.new().to_string(c)}, NoSqlWriter.new("mongodb", "localhost", "admin", "password123"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment