blob: 62589c44e8db12378f519ec214ea8904760b8d47 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# frozen_string_literal: true
module Arel
module Collectors
class SubstituteBinds
def initialize
@parts = []
end
def << str
@parts << str
self
end
def add_bind bind
@parts << bind
self
end
def value; @parts; end
def substitute_binds bvs
bvs = bvs.dup
@parts.map do |val|
if Arel::Nodes::BindParam === val
bvs.shift
else
val
end
end
end
def compile bvs
substitute_binds(bvs).join
end
end
end
end
|