Class: ElasticsearchRecord::StatementCache::PartialQueryCollector

Inherits:
ActiveRecord::StatementCache::PartialQueryCollector
  • Object
show all
Defined in:
lib/elasticsearch_record/statement_cache.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#add_bind(obj) ⇒ Object



57
58
59
60
61
62
63
64
# File 'lib/elasticsearch_record/statement_cache.rb', line 57

def add_bind(obj)
  super

  # only add binds, no parts - so we need to remove the previously set part
  @parts.pop

  self
end

#add_binds(binds, proc_for_binds = nil) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/elasticsearch_record/statement_cache.rb', line 66

def add_binds(binds, proc_for_binds = nil)
  super

  # only add binds, no parts - so we need to remove the previously set part
  if binds.size == 1
    @parts.pop
  else
    @parts.pop((binds.size * 2) - 1)
  end

  self
end