Module: Card::Query::Clause

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

Instance Method Summary collapse

Instance Method Details

#connectionObject



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

def connection
  @connection ||= ActiveRecord::Base.connection
end

#quote(v) ⇒ Object



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

def quote v
  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