Class: Oso::Polar::Data::Filter
- Inherits:
 - 
      Object
      
        
- Object
 - Oso::Polar::Data::Filter
 
 
- Defined in:
 - lib/oso/polar/data/filter.rb
 
Overview
Abstract data filter used by the Adapter API.
Defined Under Namespace
Classes: Condition, Projection, Relation
Instance Attribute Summary collapse
- 
  
    
      #conditions  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute conditions.
 - 
  
    
      #model  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute model.
 - 
  
    
      #relations  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute relations.
 - 
  
    
      #types  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute types.
 
Class Method Summary collapse
Instance Method Summary collapse
- 
  
    
      #initialize(model:, relations:, conditions:, types:)  ⇒ Filter 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Filter.
 
Constructor Details
#initialize(model:, relations:, conditions:, types:) ⇒ Filter
Returns a new instance of Filter.
      11 12 13 14 15 16  | 
    
      # File 'lib/oso/polar/data/filter.rb', line 11 def initialize(model:, relations:, conditions:, types:) @model = model @relations = relations @conditions = conditions @types = types end  | 
  
Instance Attribute Details
#conditions ⇒ Object (readonly)
Returns the value of attribute conditions.
      9 10 11  | 
    
      # File 'lib/oso/polar/data/filter.rb', line 9 def conditions @conditions end  | 
  
#model ⇒ Object (readonly)
Returns the value of attribute model.
      9 10 11  | 
    
      # File 'lib/oso/polar/data/filter.rb', line 9 def model @model end  | 
  
#relations ⇒ Object (readonly)
Returns the value of attribute relations.
      9 10 11  | 
    
      # File 'lib/oso/polar/data/filter.rb', line 9 def relations @relations end  | 
  
#types ⇒ Object (readonly)
Returns the value of attribute types.
      9 10 11  | 
    
      # File 'lib/oso/polar/data/filter.rb', line 9 def types @types end  | 
  
Class Method Details
.parse(polar, blob) ⇒ Object
      18 19 20 21 22 23 24 25 26 27 28  | 
    
      # File 'lib/oso/polar/data/filter.rb', line 18 def self.parse(polar, blob) types = polar.host.types model = types[blob['root']].klass.get relations = blob['relations'].map do |rel| Relation.parse(polar, *rel) end conditions = blob['conditions'].map do |disj| disj.map { |conj| Condition.parse(polar, *conj) } end new(model: model, relations: relations, conditions: conditions, types: types) end  |