Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.ruby Subject: Re: getting in between results of chunks of ruby code, by how??? Date: Wed, 23 Dec 2015 11:14:28 +0100 Lines: 29 Message-ID: References: <5fc33a05-0c6f-4082-a815-3dc044b13cff@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net RGaWDZZdVu7EBVqb9uTpBArJ9AQWcU6Ncifk3pkQQwRQ5lw2g= Cancel-Lock: sha1:Z8vBmrQKQmXyLQtwmWb/AoQay4o= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 In-Reply-To: Xref: csiph.com comp.lang.ruby:7175 On 23.12.2015 10:37, artbot wrote: > it's going to be part of my (very specialized) template engine. And what makes it special? What are your requirements etc.? > it should be as code/ruby agnostic as possible. evaluating each block > should just recognize if it produces a result or not. also repetitions > should get recognized (as above) You cannot recognize that and be Ruby agnostic at the same time. Just look at your example: you have a block there as second array element which is invoked an unknown number of times by the first chunk. So you would somehow have to tap into the callback from #times and store all evaluation results of the block's body etc. No way this flies by only being mildly Ruby agnostic. > any more ideas? You provide the requirements, others can come up with ideas. Regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/