Class: Elasticity::Search::ActiveRecordProxy::Relation

Inherits:
ActiveSupport::ProxyObject
  • Object
show all
Defined in:
lib/elasticity/search.rb

Instance Method Summary collapse

Constructor Details

#initialize(relation, search_definition, response) ⇒ Relation

Returns a new instance of Relation.



212
213
214
215
216
217
# File 'lib/elasticity/search.rb', line 212

def initialize(relation, search_definition, response)
  @relation = relation
  @search_definition = search_definition
  @response = response
  @results = Results.new(response, search_definition)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



219
220
221
# File 'lib/elasticity/search.rb', line 219

def method_missing(name, *args, &block)
  @relation.public_send(name, *args, &block)
end

Instance Method Details

#inspectObject



229
230
231
# File 'lib/elasticity/search.rb', line 229

def inspect
  "#<#{self.class}: #{@relation.to_sql}>"
end

#pretty_print(pp) ⇒ Object



223
224
225
226
227
# File 'lib/elasticity/search.rb', line 223

def pretty_print(pp)
  pp.object_group(self) do
    pp.text " #{@relation.to_sql}"
  end
end