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.rb29
1 files changed, 29 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..3f40eec8a8
--- /dev/null
+++ b/activerecord/lib/arel/collectors/substitute_binds.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+module Arel # :nodoc: all
+ 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