Class: Sinatra::Pagers::PagerCdQueryAdapter
- Inherits:
 - 
      Object
      
        
- Object
 - Sinatra::Pagers::PagerCdQueryAdapter
 
 
- Defined in:
 - lib/sinatra/pagers.rb
 
Instance Attribute Summary collapse
- 
  
    
      #cds_out  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute cds_out.
 
Instance Method Summary collapse
- 
  
    
      #initialize(pager, cds_pre)  ⇒ PagerCdQueryAdapter 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of PagerCdQueryAdapter.
 - #process ⇒ Object
 
Constructor Details
#initialize(pager, cds_pre) ⇒ PagerCdQueryAdapter
Returns a new instance of PagerCdQueryAdapter.
      32 33 34 35 36 37  | 
    
      # File 'lib/sinatra/pagers.rb', line 32 def initialize(pager, cds_pre) @pager=pager @cds_pre=cds_pre @cds_out=@cds_pre process end  | 
  
Instance Attribute Details
#cds_out ⇒ Object (readonly)
Returns the value of attribute cds_out.
      31 32 33  | 
    
      # File 'lib/sinatra/pagers.rb', line 31 def cds_out @cds_out end  | 
  
Instance Method Details
#process ⇒ Object
      38 39 40 41 42 43 44 45  | 
    
      # File 'lib/sinatra/pagers.rb', line 38 def process if @pager.query.to_s!="" cd_ids=@cds_pre.find_all {|v| v[:title].include? @pager.query or v[:author].include? @pager.query }.map {|v| v[0]} @cds_out=@cds_pre.where(:id => cd_ids) end end  |