Class: Potter::AST::Binary

Inherits:
Node
  • Object
show all
Defined in:
lib/potter/ast/binary.rb

Instance Method Summary collapse

Methods inherited from Node

#eql?, #hash, #name, #symbol, #visit

Constructor Details

#initialize(left, right) ⇒ Binary

Returns a new instance of Binary.



4
5
6
7
8
# File 'lib/potter/ast/binary.rb', line 4

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

Instance Method Details

#evalObject



15
# File 'lib/potter/ast/binary.rb', line 15

def eval = @left.eval.public_send(symbol, @right.eval)

#walk {|@left| ... } ⇒ Object

Yields:

  • (@left)


10
11
12
13
# File 'lib/potter/ast/binary.rb', line 10

def walk
  yield @left
  yield @right
end