push
travis-ci
20259 of 30092 relevant lines covered (67.32%)
206.62 hits per line
1 |
module Queries |
× |
2 |
class Namespace::Autocomplete < Queries::Query |
× |
3 |
|
|
4 |
# @return [String]
|
|
5 |
def where_sql |
× |
6 |
named.or(or_clauses).to_sql |
× |
7 |
end
|
× |
8 |
|
|
9 |
def or_clauses |
× |
10 |
clauses = [ |
× |
11 |
short_named, |
× |
12 |
verbatim_short_named, |
× |
13 |
with_id |
× |
14 |
].compact |
× |
15 |
|
|
16 |
a = clauses.shift |
× |
17 |
clauses.each do |b|
|
× |
18 |
a = a.or(b) |
× |
19 |
end
|
× |
20 |
a |
× |
21 |
end
|
× |
22 |
|
|
23 |
def short_named |
× |
24 |
table[:short_name].matches_any(terms)
|
× |
25 |
end
|
× |
26 |
|
|
27 |
def verbatim_short_named |
× |
28 |
table[:verbatim_short_name].matches_any(terms)
|
× |
29 |
end
|
× |
30 |
|
|
31 |
def all |
× |
32 |
::Namespace.where(where_sql)
|
× |
33 |
end
|
× |
34 |
|
|
35 |
def table |
× |
36 |
::Namespace.arel_table
|
× |
37 |
end
|
× |
38 |
end
|
× |
39 |
end
|
× |