Good use of Adapter pattern?
Leam Hall <[email protected]> Sun, 1 Sep 2019 06:54:55 -0400
| Newsgroups | gmane.comp.lang.ruby.general |
|---|---|
| Message-ID | <[email protected]> |
I'm building my OO skills (about 30 years late) and am learning a little bit about patterns. While they may not be the be all and end all, my current use case might be a good fit for the Adapter. Looking for a little wisdom before I jump in. I have a module, "data_mine", currently with two methods. "get_random_line_from_file" returns a string from a file, and it uses "array_from_file" to intake a line delimited file of possible data options. The goal is to change the "get" method so it can take an optional positive integer and return that many items, and for the source of data to be either a line based file, a CSV file, a MongoDB or SQLite datastore, etc. Is the Adapter pattern a good fit for this refactoring? Thanks! Leam Unsubscribe: <mailto:[email protected]?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>