Class: Card::Query::Clause
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
Returns the value of attribute clause.
3
4
5
|
# File 'lib/card/query/clause.rb', line 3
def clause
@clause
end
|
Instance Method Details
#cast_type(type) ⇒ Object
17
18
19
20
|
# File 'lib/card/query/clause.rb', line 17
def cast_type(type)
cxn ||= ActiveRecord::Base.connection
(val = cxn.cast_types[type.to_sym]) ? val[:name] : safe_sql(type)
end
|
#match_prep(v) ⇒ Object
12
13
14
15
|
# File 'lib/card/query/clause.rb', line 12
def match_prep(v)
cxn ||= ActiveRecord::Base.connection
[cxn, v]
end
|
10
|
# File 'lib/card/query/clause.rb', line 10
def quote(v) ActiveRecord::Base.connection.quote(v) end
|
#safe_sql(txt) ⇒ Object
5
6
7
8
|
# File 'lib/card/query/clause.rb', line 5
def safe_sql(txt)
txt = txt.to_s
txt.match( /[^\w\*\(\)\s\.\,]/ ) ? raise( "WQL contains disallowed characters: #{txt}" ) : txt
end
|