David Alan Black <dblack / candle.superlink.net> wrote: > On Sun, 11 Feb 2001, Michael Schuerig wrote: > > def openAsText(file) > > block = Proc.new > > > > filter = buildTextFilter(file) > > > > if filter.empty? > > File.open(file) { |f| block.call(f) } > > else > > IO.popen("cat #{file} #{filter}") { |f| block.call(f) } > > end > > end > Your example looks like it might also lend itself to a nice 'yield' > approach: > > if filter.empty? > yield File.open(file) > else > yield IO.popen("cat....") > end > > in which case openAsText wouldn't have to know about the block at > all. (I can't help it -- I love 'yield'!) That's what I've been looking for. Thanks! Maybe I'll learn to love 'yield', too. At least I'm one step further after understanding why and how the above works. Michael -- Michael Schuerig mailto:schuerig / acm.org http://www.schuerig.de/michael/