Class: Ruby::Rego::AST::UnaryOp
- Defined in:
- lib/ruby/rego/ast/unary_op.rb
Overview
Represents a unary operation (e.g. negation).
Constant Summary collapse
- OPERATORS =
%i[not minus].freeze
Instance Attribute Summary collapse
-
#operand ⇒ Object
readonly
-
#operator ⇒ Symbol
readonly
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(operator:, operand:, location: nil) ⇒ UnaryOp
constructor
A new instance of UnaryOp.
Methods inherited from Base
#==, #accept, #deconstruct_keys, #eql?, format_value, #hash, #to_s
Constructor Details
#initialize(operator:, operand:, location: nil) ⇒ UnaryOp
Returns a new instance of UnaryOp.
15 16 17 18 19 20 |
# File 'lib/ruby/rego/ast/unary_op.rb', line 15 def initialize(operator:, operand:, location: nil) @operator = operator validate_operator! super(location: location) @operand = operand end |
Instance Attribute Details
#operand ⇒ Object (readonly)
26 27 28 |
# File 'lib/ruby/rego/ast/unary_op.rb', line 26 def operand @operand end |
#operator ⇒ Symbol (readonly)
23 24 25 |
# File 'lib/ruby/rego/ast/unary_op.rb', line 23 def operator @operator end |