Class: Namarara::OrOp

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lval, rval) ⇒ OrOp

Returns a new instance of OrOp.



123
124
125
126
127
128
129
# File 'lib/namarara/parser.rb', line 123

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.



121
122
123
# File 'lib/namarara/parser.rb', line 121

def errors
  @errors
end

Instance Method Details

#computeObject



131
132
133
134
135
# File 'lib/namarara/parser.rb', line 131

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

#to_sObject



137
138
139
# File 'lib/namarara/parser.rb', line 137

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