Class: YARP::ImaginaryNode

Inherits:
YARPNode
  • Object
show all
Defined in:
lib/yarp/node.rb,
ext/yarp/api_node.c

Overview

Represents an imaginary number literal.

1.0i
^^^^

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(numeric, location) ⇒ ImaginaryNode

def initialize: (numeric: Node, location: Location) -> void



3005
3006
3007
3008
# File 'lib/yarp/node.rb', line 3005

def initialize(numeric, location)
  @numeric = numeric
  @location = location
end

Instance Attribute Details

#numericObject (readonly)

attr_reader numeric: Node



3002
3003
3004
# File 'lib/yarp/node.rb', line 3002

def numeric
  @numeric
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



3011
3012
3013
# File 'lib/yarp/node.rb', line 3011

def accept(visitor)
  visitor.visit_imaginary_node(self)
end

#child_nodesObject Also known as: deconstruct

def child_nodes: () -> Array[nil | Node]



3017
3018
3019
# File 'lib/yarp/node.rb', line 3017

def child_nodes
  [numeric]
end

#deconstruct_keys(keys) ⇒ Object

def deconstruct_keys: (keys: Array) -> Hash[Symbol, nil | Node | Array | String | Token | Array | Location]



3025
3026
3027
# File 'lib/yarp/node.rb', line 3025

def deconstruct_keys(keys)
  { numeric: numeric, location: location }
end