Module: Card::Query::Clause
Instance Method Summary collapse
- #connection ⇒ Object
- #quote(v) ⇒ Object
-
#safe_sql(txt) ⇒ Object
attr_accessor :clause.
Instance Method Details
#connection ⇒ Object
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 |