Module: Card::Query::Clause

Included in:
Card::Query, Value
Defined in:
lib/card/query/clause.rb

Instance Method Summary collapse

Instance Method Details

#match_prep(v) ⇒ Object



14
15
16
17
# File 'lib/card/query/clause.rb', line 14

def match_prep v
  cxn ||= ActiveRecord::Base.connection
  [cxn, v]
end

#quote(v) ⇒ Object



10
11
12
# File 'lib/card/query/clause.rb', line 10

def quote v
  ActiveRecord::Base.connection.quote(v)
end

#safe_sql(txt) ⇒ Object

attr_accessor :clause



5
6
7
8
# File 'lib/card/query/clause.rb', line 5

def safe_sql txt
  txt = txt.to_s
  txt =~ /[^\w\*\(\)\s\.\,]/ ? raise("WQL contains disallowed characters: #{txt}") : txt
end