Class: Releaf::Search
- Inherits:
- 
      Object
      
        - Object
- Releaf::Search
 
- Defined in:
- app/lib/releaf/search.rb
Instance Attribute Summary collapse
- 
  
    
      #fields  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute fields. 
- 
  
    
      #join_index  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute join_index. 
- 
  
    
      #relation  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute relation. 
- 
  
    
      #searchable_arel_fields  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute searchable_arel_fields. 
- 
  
    
      #text  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute text. 
Class Method Summary collapse
Instance Method Summary collapse
- 
  
    
      #initialize(relation:, fields:, text:)  ⇒ Search 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Search. 
- #prepare ⇒ Object
Constructor Details
#initialize(relation:, fields:, text:) ⇒ Search
Returns a new instance of Search.
| 13 14 15 16 17 | # File 'app/lib/releaf/search.rb', line 13 def initialize(relation: , fields:, text:) self.relation = relation.all self.fields = fields self.text = text end | 
Instance Attribute Details
#fields ⇒ Object
Returns the value of attribute fields.
| 3 4 5 | # File 'app/lib/releaf/search.rb', line 3 def fields @fields end | 
#join_index ⇒ Object
Returns the value of attribute join_index.
| 3 4 5 | # File 'app/lib/releaf/search.rb', line 3 def join_index @join_index end | 
#relation ⇒ Object
Returns the value of attribute relation.
| 3 4 5 | # File 'app/lib/releaf/search.rb', line 3 def relation @relation end | 
#searchable_arel_fields ⇒ Object
Returns the value of attribute searchable_arel_fields.
| 3 4 5 | # File 'app/lib/releaf/search.rb', line 3 def searchable_arel_fields @searchable_arel_fields end | 
#text ⇒ Object
Returns the value of attribute text.
| 3 4 5 | # File 'app/lib/releaf/search.rb', line 3 def text @text end | 
Class Method Details
.prepare(relation:, fields:, text:) ⇒ Object
| 7 8 9 10 11 | # File 'app/lib/releaf/search.rb', line 7 def self.prepare(relation:, fields:, text:) searcher = new(relation: relation, fields: fields, text: text) searcher.prepare searcher.relation end | 
Instance Method Details
#prepare ⇒ Object
| 19 20 21 22 23 24 25 | # File 'app/lib/releaf/search.rb', line 19 def prepare self.join_index = 0 self.searchable_arel_fields = [] join_search_tables(base_class) add_search_to_relation end |