class AST::Node

redefining in order to allow type itself to be any type e.g. String, Symbol, Fixnum, etc.

Public Class Methods

new(type, children=[], properties={}) click to toggle source

The `properties` hash is passed to {#assign_properties}.

# File lib/ast_ext/node.rb, line 9
def initialize(type, children=[], properties={})
  @type, @children = type, children.to_a.freeze

  assign_properties(properties)

  @hash = [@type.object_id, @children, self.class].hash

  freeze
end

Public Instance Methods

print(logic=nil) click to toggle source

@param logic [Hash] hash of operators allowed in this AST containing each operator's print properties @return [String] string reconstituted from polish-notation into notation normally required by each operator