Module: AST

Included in:
Node, Fixnum, Symbolic, Symbolic::Coerced, Symbolic::Variable
Defined in:
lib/ast_ext/node.rb

Defined Under Namespace

Classes: Node

Instance Method Summary collapse

Instance Method Details

#new_ast(op, *obj) ⇒ Object

class Node



46
47
48
49
50
51
52
# File 'lib/ast_ext/node.rb', line 46

def new_ast(op, *obj)
  args = obj.collect do |o| o.is_a?(Node) ? o : Node.new(o) end
  args.unshift self if is_a?(Node)
  args.unshift Node.new(self) if is_a?(Fixnum)
  args.unshift Node.new(self) if self.is_a?(Symbolic::Variable)
  Node.new(op, args)
end