Class: JSONP3::InfixExpression
- Inherits:
 - 
      Expression
      
        
- Object
 - Expression
 - JSONP3::InfixExpression
 
 
- Defined in:
 - lib/json_p3/filter.rb
 
Overview
Base class for expression with a left expression, operator and right expression.
Direct Known Subclasses
EqExpression, GeExpression, GtExpression, LeExpression, LogicalAndExpression, LogicalOrExpression, LtExpression, NeExpression
Instance Attribute Summary collapse
- 
  
    
      #left  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute left.
 - 
  
    
      #right  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute right.
 
Attributes inherited from Expression
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
 - #evaluate(_context) ⇒ Object
 - #hash ⇒ Object
 - 
  
    
      #initialize(token, left, right)  ⇒ InfixExpression 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of InfixExpression.
 - #to_s ⇒ Object
 
Constructor Details
#initialize(token, left, right) ⇒ InfixExpression
Returns a new instance of InfixExpression.
      172 173 174 175 176  | 
    
      # File 'lib/json_p3/filter.rb', line 172 def initialize(token, left, right) super(token) @left = left @right = right end  | 
  
Instance Attribute Details
#left ⇒ Object (readonly)
Returns the value of attribute left.
      170 171 172  | 
    
      # File 'lib/json_p3/filter.rb', line 170 def left @left end  | 
  
#right ⇒ Object (readonly)
Returns the value of attribute right.
      170 171 172  | 
    
      # File 'lib/json_p3/filter.rb', line 170 def right @right end  | 
  
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
      186 187 188 189 190 191  | 
    
      # File 'lib/json_p3/filter.rb', line 186 def ==(other) self.class == other.class && @left == other.left && @right == other.right && @token == other.token end  | 
  
#evaluate(_context) ⇒ Object
      178 179 180  | 
    
      # File 'lib/json_p3/filter.rb', line 178 def evaluate(_context) raise "infix expressions must implement `evaluate(context)`" end  | 
  
#hash ⇒ Object
      195 196 197  | 
    
      # File 'lib/json_p3/filter.rb', line 195 def hash [@left, @right, @token].hash end  | 
  
#to_s ⇒ Object
      182 183 184  | 
    
      # File 'lib/json_p3/filter.rb', line 182 def to_s raise "infix expressions must implement `to_s`" end  |