Class: Rgviz::BinaryExpression

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

Constant Summary collapse

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
StartsWith =
:'starts with'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(left, operator, right) ⇒ BinaryExpression

Returns a new instance of BinaryExpression.



254
255
256
257
258
# File 'lib/rgviz/nodes.rb', line 254

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

Instance Attribute Details

#leftObject

Returns the value of attribute left.



251
252
253
# File 'lib/rgviz/nodes.rb', line 251

def left
  @left
end

#operatorObject

Returns the value of attribute operator.



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

def operator
  @operator
end

#rightObject

Returns the value of attribute right.



252
253
254
# File 'lib/rgviz/nodes.rb', line 252

def right
  @right
end

Instance Method Details

#accept(visitor) ⇒ Object



260
261
262
263
264
265
266
# File 'lib/rgviz/nodes.rb', line 260

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



268
269
270
# File 'lib/rgviz/nodes.rb', line 268

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