From: Dark Ambient Date: 2006-07-12T05:01:01+09:00 Subject: Re: blocks and procs ------=_Part_171805_9505499.1152648057440 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Got it, had to remove the former query. Working now, on to lamda. Stuart On 7/11/06, James Edward Gray II wrote: > > On Jul 11, 2006, at 2:31 PM, Dark Ambient wrote: > > > hmmmm....i have that code in there: > > > >> def select( query ) > >> # parse query String > >> rules = Hash[*query.split(/\s*AND\s*/).map do |rule| > >> rule.split(/\s*=\s*/).map { |value| value.sub(/^['"](.+) > >> ['"]$/, > >> '\1') } end.flatten ] > >> > >> #match records > >> @records.select { |record| block_given? and yield record } > >> rules.all? { |field, value| record.send(field) == value } > >> > >> > >> end # end of method > >> > >> end # end of class > > That's from higher up in the article. Here's the one just before the > example you showed: > > class ClientDB > def select > @records.select { |record| block_given? and yield record } > end > end > > Try that. > > James Edward Gray II > > ------=_Part_171805_9505499.1152648057440--