Sha256: 284349c82d7108fd828568576d6f63d49e2ae620e1834a2b82550728f58d9301
Contents?: true
Size: 1.12 KB
Versions: 9
Compression:
Stored size: 1.12 KB
Contents
module NotRelational class OrCondition attr_accessor :child_conditions def initialize(child_conditions=[]) self.child_conditions=child_conditions end def add(child_condition) self.child_conditions<<child_condition end def matches?(domain_model) self.child_conditions.each do | condition| if condition.respond_to?(:matches?) if condition.matches?(domain_model) return true end end end return false end def to_sdb_query first =true query="" count=0 self.child_conditions.each do | condition| count=count+1 if ! first if count>4 query<< " ] union [ " count=0 else query<< " or " end end first=false if condition.respond_to?(:to_sdb_query) query << condition.to_sdb_query else query << condition.to_s end end return query end end end
Version data entries
9 entries across 9 versions & 1 rubygems