Class: Ruby::Rego::AST::BinaryOp
- Defined in:
- lib/ruby/rego/ast/binary_op.rb
Overview
Represents a binary operation.
Constant Summary collapse
- OPERATORS =
%i[ eq neq and or lt lte gt gte in plus minus mult div mod assign unify ].freeze
Instance Attribute Summary collapse
-
#left ⇒ Object
readonly
-
#operator ⇒ Symbol
readonly
-
#right ⇒ Object
readonly
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(operator:, left:, right:, location: nil) ⇒ BinaryOp
constructor
A new instance of BinaryOp.
Methods inherited from Base
#==, #accept, #deconstruct_keys, #eql?, format_value, #hash, #to_s
Constructor Details
#initialize(operator:, left:, right:, location: nil) ⇒ BinaryOp
Returns a new instance of BinaryOp.
33 34 35 36 37 38 39 |
# File 'lib/ruby/rego/ast/binary_op.rb', line 33 def initialize(operator:, left:, right:, location: nil) @operator = operator validate_operator! super(location: location) @left = left @right = right end |
Instance Attribute Details
#left ⇒ Object (readonly)
45 46 47 |
# File 'lib/ruby/rego/ast/binary_op.rb', line 45 def left @left end |
#operator ⇒ Symbol (readonly)
42 43 44 |
# File 'lib/ruby/rego/ast/binary_op.rb', line 42 def operator @operator end |
#right ⇒ Object (readonly)
48 49 50 |
# File 'lib/ruby/rego/ast/binary_op.rb', line 48 def right @right end |