aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/arel/collectors/substitute_binds.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/arel/collectors/substitute_binds.rb')
-rw-r--r--activerecord/lib/arel/collectors/substitute_binds.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/activerecord/lib/arel/collectors/substitute_binds.rb b/activerecord/lib/arel/collectors/substitute_binds.rb
new file mode 100644
index 0000000000..99d2215aaa
--- /dev/null
+++ b/activerecord/lib/arel/collectors/substitute_binds.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+module Arel
+ module Collectors
+ class SubstituteBinds
+ def initialize(quoter, delegate_collector)
+ @quoter = quoter
+ @delegate = delegate_collector
+ end
+
+ def << str
+ delegate << str
+ self
+ end
+
+ def add_bind bind
+ self << quoter.quote(bind)
+ end
+
+ def value
+ delegate.value
+ end
+
+ protected
+
+ attr_reader :quoter, :delegate
+ end
+ end
+end