class Card::Query::ReferenceQuery
support the use of the card_references table in CQL
Public Instance Methods
Source
# File lib/card/query/reference_query.rb, line 21 def add_conditions outfield, hash add_reftype_condition hash[:reftype] add_outfield_condition outfield, hash[:card] end
Source
# File lib/card/query/reference_query.rb, line 26 def add_outfield_condition outfield, outcard if outcard == "_none" non_outfield elsif (op_and_id = op_and_id_or_ids_from_val(outcard)) outfield_id outfield, op_and_id else tie :card, outcard, from: outfield end end
Source
# File lib/card/query/reference_query.rb, line 44 def add_reftype_condition reftype return unless reftype.present? reftype = Array.wrap reftype operator = (reftype.size == 1 ? "=" : "IN") quoted_letters = reftype.map { |letter| "'#{letter}'" } * ", " add_condition "#{fld(:ref_type)} #{operator} (#{quoted_letters})" end
Source
# File lib/card/query/reference_query.rb, line 36 def non_outfield add_condition "#{fld :is_present} = 0" end
Source
# File lib/card/query/reference_query.rb, line 40 def outfield_id outfield, op_and_id add_condition "#{fld(outfield)} #{op_and_id}" end
Source
# File lib/card/query/reference_query.rb, line 17 def referee hash add_conditions :referee_id, hash end
Source
# File lib/card/query/reference_query.rb, line 13 def referer hash add_conditions :referer_id, hash end