Class: Synthra::Parser::AST::ModifierNode

Inherits:
Node
  • Object
show all
Defined in:
lib/synthra/parser/ast.rb

Overview

Modifier node for field modifiers

Represents a modifier applied to a field (unique, range, etc.).

Examples:

DSL

id: uuid unique
age: number(18..80)  # range is often embedded in type args

AST

ModifierNode.new(name: :unique, value: true)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, value:, line: nil) ⇒ ModifierNode

Create a new ModifierNode

Parameters:

  • name (String, Symbol)

    modifier name

  • value (Object)

    modifier value

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

    source line number



562
563
564
565
566
# File 'lib/synthra/parser/ast.rb', line 562

def initialize(name:, value:, line: nil)
  super(line: line)
  @name = name.to_sym
  @value = value
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



547
548
549
# File 'lib/synthra/parser/ast.rb', line 547

def name
  @name
end

#valueObject (readonly)

Returns the value of attribute value.



553
554
555
# File 'lib/synthra/parser/ast.rb', line 553

def value
  @value
end