Module: RSolr::Ext::Model::Findable
- Defined in:
- lib/rsolr-ext/model.rb
Overview
Findable is a module that gets mixed into the SolrDocument class object. These methods will be available through the class: SolrDocument.find
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
Instance Method Summary collapse
-
#find(*args, &block) ⇒ Object
this method decorates the connection find method and then creates new instance of the class that uses this module.
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
60 61 62 |
# File 'lib/rsolr-ext/model.rb', line 60 def connection @connection end |
Instance Method Details
#find(*args, &block) ⇒ Object
this method decorates the connection find method and then creates new instance of the class that uses this module.
68 69 70 71 72 73 74 75 |
# File 'lib/rsolr-ext/model.rb', line 68 def find *args, &block response = connection.find(*args) response.docs.map {|doc| d = self.new doc, response yield d if block_given? d } end |