Represents a rational number literal.

1.0r
^^^^
Attributes
Read

The numerator of the rational number.

1.5r # numerator 3

The denominator of the rational number.

1.5r # denominator 2
Class Methods

Initialize a new RationalNode node.

Return a symbol representation of this node type. See ‘Node::type`.

Instance Methods

Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.

def accept: (Visitor visitor) -> void

def binary?: () -> bool

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

def comment_targets: () -> Array[Node | Location]

def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?numerator: Integer, ?denominator: Integer) -> RationalNode

def decimal?: () -> bool

An alias for child_nodes

def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, numerator: Integer, denominator: Integer }

def hexadecimal?: () -> bool

def inspect -> String

Returns the value of the node as an IntegerNode or a FloatNode. This method is deprecated in favor of value or numerator/#denominator.

def octal?: () -> bool

Return a symbol representation of this node type. See ‘Node#type`.

Returns the value of the node as a Ruby Rational.