Class: Arel::Collectors::SubstituteBinds

Inherits:
Object
  • Object
show all
Defined in:
activerecord/lib/arel/collectors/substitute_binds.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(quoter, delegate_collector) ⇒ SubstituteBinds

Returns a new instance of SubstituteBinds.



8
9
10
11
# File 'activerecord/lib/arel/collectors/substitute_binds.rb', line 8

def initialize(quoter, delegate_collector)
  @quoter = quoter
  @delegate = delegate_collector
end

Instance Attribute Details

#preparableObject

Returns the value of attribute preparable



6
7
8
# File 'activerecord/lib/arel/collectors/substitute_binds.rb', line 6

def preparable
  @preparable
end

Instance Method Details

#<<(str) ⇒ Object



13
14
15
16
# File 'activerecord/lib/arel/collectors/substitute_binds.rb', line 13

def <<(str)
  delegate << str
  self
end

#add_bind(bind) ⇒ Object



18
19
20
21
# File 'activerecord/lib/arel/collectors/substitute_binds.rb', line 18

def add_bind(bind)
  bind = bind.value_for_database if bind.respond_to?(:value_for_database)
  self << quoter.quote(bind)
end

#add_binds(binds, proc_for_binds = nil) ⇒ Object



23
24
25
# File 'activerecord/lib/arel/collectors/substitute_binds.rb', line 23

def add_binds(binds, proc_for_binds = nil)
  self << binds.map { |bind| quoter.quote(bind) }.join(", ")
end

#valueObject



27
28
29
# File 'activerecord/lib/arel/collectors/substitute_binds.rb', line 27

def value
  delegate.value
end