Created
March 23, 2019 12:47
-
-
Save jasongorman/5562cdf83eedc5260065ab14d2832b7c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ResponseWriter | |
def write(customer, serializer, writer) | |
writer.write(serializer.serialize(customer)) | |
end | |
end | |
customer = Customer.new("Mr", "Jason", "Gorman") | |
writer = ResponseWriter.new | |
writer.write(customer, HtmlSerializer.new(), ConsoleWriter.new) | |
writer.write(customer, XmlSerializer.new(), LogFileWriter.new("C:\test\testlog.txt")) | |
writer.write(customer, StringSerializer.new(), NoSqlWriter.new("mongodb", "localhost", "admin", "password123")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment