mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
32 lines
495 B
Ruby
32 lines
495 B
Ruby
module Arel
|
|
module Collectors
|
|
class Bind
|
|
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
|
|
end
|
|
end
|
|
end
|