Class: Namarara::AndOp

Inherits:
TreeExpr show all
Defined in:
lib/namarara/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lval, rval) ⇒ AndOp

Returns a new instance of AndOp.



101
102
103
104
105
106
107
# File 'lib/namarara/parser.rb', line 101

def initialize(lval, rval)
  @errors = []
  @errors.concat lval.errors
  @errors.concat rval.errors
  @lval = lval
  @rval = rval
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



99
100
101
# File 'lib/namarara/parser.rb', line 99

def errors
  @errors
end

Instance Method Details

#computeObject



109
110
111
112
113
# File 'lib/namarara/parser.rb', line 109

def compute
  # rubocop:disable Style/DoubleNegation
  !!@lval.compute && !!@rval.compute
  # rubocop:enable Style/DoubleNegation
end

#to_sObject



115
116
117
# File 'lib/namarara/parser.rb', line 115

def to_s
  "( #{@lval} ) AND ( #{@rval} )"
end