1module Arel |
|
2 module Nodes |
|
3 class Contained < Arel::Nodes::Binary |
|
4 def operator |
|
5 "<@" |
|
6 end |
|
7 end |
|
9 class Contains < Arel::Nodes::Binary |
|
10 def operator |
|
11 "@>" |
|
12 end |
|
13 end |
|
15 class Overlaps < Arel::Nodes::Binary |
|
16 def operator |
|
17 "&&" |
|
18 end |
|
19 end |
|
20 end |
|
22 module Predications |
|
23 def contained(other) |
|
24 Nodes::Contained.new(self, quoted_node(other)) |
|
25 end |
|
27 def contains(other) |
|
28 Nodes::Contains.new(self, quoted_node(other)) |
|
29 end |
|
31 def overlaps(other) |
|
32 Nodes::Overlaps.new(self, quoted_node(other)) |
|
33 end |
|
34 end |
|
36 module Visitors |
|
37 class PostgreSQL < Arel::Visitors::ToSql |
|
38 private
|
|
|
40 def visit_Arel_Nodes_Contained(o, collector) |
41 infix_value(o, collector, " <@ ") |
|
42 end |
|
|
44 def visit_Arel_Nodes_Contains(o, collector) |
45 infix_value(o, collector, " @> ") |
|
46 end |
|
|
48 def visit_Arel_Nodes_Overlaps(o, collector) |
49 infix_value(o, collector, " && ") |
|
50 end |
|
51 end |
|
52 end |
|
53end |