3 ms·
Any reason you did parseClosure(x,y,lambda {|doc,out| ... }) instead of parseClosure(x,y) { |doc,out| ... } ?
by bct 19y ago
Any reason you did parseClosure(x,y,lambda {|doc,out| ... }) instead of parseClosure(x,y) { |doc,out| ... } ?
- Readmore 19y agoI tried to pass the codeProc.call in the block but it wouldn't process the data until I passed the codeProc as a parameter. I don't really understand why to be honest.
- bct 19y agoI don't know why it wouldn't have. You should have been able to do: out = parseClosure(curr_page, cnt) { |doc,out| eval(codeStr) } ... def parseClosure(curr_page, cnt) ... yield(doc, out) or: def parseClosure(curr_page, cnt, &codeProc) There's not much opportunity to use lambda explicity in Ruby because using blocks instead is so easy.
- Readmore 19y agoYou are correct sir! I bow to your ruby-fu! Thanks.