From: James Byrne Date: 2006-02-23T01:18:58+09:00 Subject: Re: A small refractory problem Ross Bamford wrote: > > Maybe something like: > > def move(sourcedir,globspec,targetdir,suf=nil) > [sourcedir,targetdir].each do |dir| > dir = File.expand_path(dir.to_s) > raise ArgumentError, "#{dir} not valid" unless validpath?(sourcedir) > end > end > > Not sure how the rest of your code works, but it seems to me you could > have whatever class this is return 'path' from to_s, avoiding the check > you were doing (and avoiding having to set vars outside the block). > > Hope that helps. Yes, it does help, very much so. The .move method is essentially private, although not presently declared as such. The intermediate methods called from outside the instance are .get and .put which, on reflection, are probably more suitable places to check the object class of the passed directory arguments. That simplfies the assignments in the move class as you recommend. Thank you. This is fun. Regards, Jim -- Posted via http://www.ruby-forum.com/.