Class: Synthra::Parser::AST::CustomNode

Inherits:
TypeNode show all
Defined in:
lib/synthra/parser/ast.rb

Overview

Custom function call node

Represents a custom() type that calls a registered function. The function is called during generation with the context.

Examples:

DSL

full_name: custom(:compute_full_name)

AST

CustomNode.new(function_name: :compute_full_name)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(function_name:, line: nil) ⇒ CustomNode

Create a new CustomNode

Parameters:

  • function_name (Symbol)

    name of registered function

  • line (Integer, nil) (defaults to: nil)

    source line number



686
687
688
689
690
691
692
693
# File 'lib/synthra/parser/ast.rb', line 686

def initialize(function_name:, line: nil)
  super(
    name: "custom",
    arguments: { function: function_name },
    line: line
  )
  @function_name = function_name
end

Instance Attribute Details

#function_nameObject (readonly)

Returns the value of attribute function_name.



678
679
680
# File 'lib/synthra/parser/ast.rb', line 678

def function_name
  @function_name
end