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