Class: YARP::RationalNode

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

Overview

Represents a rational number literal.

1.0r
^^^^

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(numeric, location) ⇒ RationalNode

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



4997
4998
4999
5000
# File 'lib/yarp/node.rb', line 4997

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

Instance Attribute Details

#numericObject (readonly)

attr_reader numeric: Node



4994
4995
4996
# File 'lib/yarp/node.rb', line 4994

def numeric
  @numeric
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



5003
5004
5005
# File 'lib/yarp/node.rb', line 5003

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

#child_nodesObject Also known as: deconstruct

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



5008
5009
5010
# File 'lib/yarp/node.rb', line 5008

def child_nodes
  [numeric]
end

#deconstruct_keys(keys) ⇒ Object

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



5016
5017
5018
# File 'lib/yarp/node.rb', line 5016

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