Currently, when I want to pass on the block given to one method to
called method, I do it like this:
openAsText(file) do |f|
f.each do |l|
...
end
end
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
What I'm wondering about is whether this conversion to a Proc is really
necessary or if there's a more direct way to pass on the block.
Michael
--
Michael Schuerig
mailto:schuerig / acm.org
http://www.schuerig.de/michael/