Module: Arel::Visitors::ElasticsearchBase
- Extended by:
- ActiveSupport::Concern
- Included in:
- Elasticsearch
- Defined in:
- lib/arel/visitors/elasticsearch_base.rb
Defined Under Namespace
Classes: UnsupportedVisitError
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
auto prevent visits on missing nodes
63
64
65
66
67
|
# File 'lib/arel/visitors/elasticsearch_base.rb', line 63
def method_missing(method, *args, &block)
raise(UnsupportedVisitError, method.to_s) if method.to_s[0..4] == 'visit'
super
end
|
Instance Method Details
#compile(node, collector = Arel::Collectors::ElasticsearchQuery.new) ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/arel/visitors/elasticsearch_base.rb', line 42
def compile(node, collector = Arel::Collectors::ElasticsearchQuery.new)
@nested = false
@nested_args = []
self.collector = collector
accept(node)
self.collector.value
end
|
#dispatch_as(mode) ⇒ Object
32
33
34
35
36
37
38
39
40
|
# File 'lib/arel/visitors/elasticsearch_base.rb', line 32
def dispatch_as(mode)
current, @dispatch = @dispatch, (mode == :simple ? self.class.simple_dispatch_cache : self.class.dispatch_cache)
res = yield
@dispatch = current
res
end
|
#initialize(connection) ⇒ Object
27
28
29
30
|
# File 'lib/arel/visitors/elasticsearch_base.rb', line 27
def initialize(connection)
super()
@connection = connection
end
|