Class: Rgviz::BinaryExpression

Inherits:
Object
  • Object
show all
Defined in:
lib/rgviz/nodes.rb

Constant Summary collapse

And =
Token::And
Contains =
Token::Contains
EndsWith =
:'ends with'
Eq =
Token::EQ
Gt =
Token::GT
Gte =
Token::GTE
Like =
Token::Like
Lt =
Token::LT
Lte =
Token::LTE
Matches =
Token::Matches
Neq =
Token::NEQ
Or =
Token::Or
StartsWith =
:'starts with'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(left, operator, right) ⇒ BinaryExpression

Returns a new instance of BinaryExpression.



235
236
237
238
239
# File 'lib/rgviz/nodes.rb', line 235

def initialize(left, operator, right)
  @left = left
  @operator = operator
  @right = right
end

Instance Attribute Details

#leftObject

Returns the value of attribute left.



232
233
234
# File 'lib/rgviz/nodes.rb', line 232

def left
  @left
end

#operatorObject

Returns the value of attribute operator.



231
232
233
# File 'lib/rgviz/nodes.rb', line 231

def operator
  @operator
end

#rightObject

Returns the value of attribute right.



233
234
235
# File 'lib/rgviz/nodes.rb', line 233

def right
  @right
end

Instance Method Details

#accept(visitor) ⇒ Object



241
242
243
244
245
246
247
# File 'lib/rgviz/nodes.rb', line 241

def accept(visitor)
  if visitor.visit_binary_expression(self)
    left.accept visitor
    right.accept visitor
  end
  visitor.end_visit_binary_expression self
end

#to_sObject



249
250
251
# File 'lib/rgviz/nodes.rb', line 249

def to_s
  "#{left} #{operator} #{right}"
end