From: Robert Klemme Date: 2012-08-03T06:16:34+09:00 Subject: Re: Supporting multiple versions of an API On Thu, Aug 2, 2012 at 10:08 PM, Intransition wrote: > > > On Thursday, August 2, 2012 12:14:27 PM UTC-4, Robert Klemme wrote: >> >> On Thu, Aug 2, 2012 at 4:47 PM, Intransition wrote: >> >> > Yes, that's the traditional factory approach. I actually would not want >> > to >> > use "MainFactory", as don't want it to be explicit. But it occurs to me >> > that >> > I could have redefined `Main.new` as a factory method and done it that >> > way. >> > And the more I think about it the more that seems like a better >> > approach. It >> > would work well for Main as well as other classes within it. >> >> It seems that in your case the caller decides on the version. Is that >> correct? > > > Yes, but it is actually via YAML file. It will read in, eg. > Then when it does a `Main.load` on the file, it will look for the `revision` > field and determine which version of the API to use. So it's *not* the user deciding on the API version! That's a different situation. Or does the user present the loaded YAML file? Can you be a bit more specific about your usage scenario? Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/