lib/card/query.rb in card-1.101.0 vs lib/card/query.rb in card-1.101.1

- old
+ new

@@ -35,16 +35,17 @@ # [ field_string_or_sym, Card::Value::Query object ] module Query require "card/query/clause" require "card/query/card_query" require "card/query/sql_statement" + # Card::Query::CardQuery - # After conversion, ATTRIBUTES is a Hash where the key is the attribute + # After conversion, @attributes is a Hash where the key is the attribute # and the value is the attribute type: # { id: :basic, name: :basic, key: :basic ...} # This is used for rapid attribute type lookups in the interpretation phase. - ATTRIBUTES = { + @attributes = { # Each of the "basic" fields corresponds directly to a database field. # their values are translated fairly directly into SQL-safe values. # (These are referred to as "properties" in CQL documentation. Need to # reconcile #EFM) basic: %i[id name key type_id content left_id right_id @@ -85,10 +86,12 @@ ) DEFAULT_ORDER_DIRS = { update: "desc", relevance: "desc" }.freeze class << self + attr_accessor :attributes + def new statement, comment=nil Query::CardQuery.new statement, comment end def run statement, comment=nil @@ -104,7 +107,9 @@ raise "CQL contains disallowed characters: #{txt}" if txt.match?(/[^\w\s*().,]/) txt end end + + delegate :attributes, to: :class end end