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.



207
208
209
210
211
212
# File 'lib/elasticity/search.rb', line 207

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



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

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

Instance Method Details

#inspectObject



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

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

#pretty_print(pp) ⇒ Object



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

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