# File lib/squish.rb, line 820 def SquishQuery.chooseTable (tables, vars) # puts "Choosing amongst tables to match vars: #{vars} \n" maybe=[] if (vars!=nil) vars.each do |v| # puts "trying for a table that knows about '#{v}' " tables.each do |t| if t.vars.member? v # puts "Got a match: #{v}" maybe.push t end end end else # raise "*** warning: chooseTable called with nil vars. (do we care?)" end # puts "Possibilities: #{maybe.size} \n" if maybe.size > 0 tables.delete(maybe[0]) ## puts "Chose table w/ #{maybe[0].vars} " return maybe[0] else raise "No plausible table" end end