Class: RSI::ANDQuery

Inherits:
Query
  • Object
show all
Defined in:
lib/rsi/query.rb

Instance Method Summary collapse

Methods inherited from Query

#add_subquery, #initialize

Methods included from Loggable

#logger

Constructor Details

This class inherits a constructor from RSI::Query

Instance Method Details

#evaluate(locator) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rsi/query.rb', line 22

def evaluate( locator )
  ret_set = nil
  @subqueries.each do |q|
    set = q.evaluate( locator )
    if ret_set.nil?
      ret_set = set
    else
      ret_set = ret_set & set
    end
    # short-circuit bottoming out
    if ret_set.size()==0
      return ret_set
    end
  end
  return ret_set
end

#to_sObject



39
40
41
# File 'lib/rsi/query.rb', line 39

def to_s
  return "( " + @subqueries.join(" AND ") + " )";
end