class YARP::RationalNode
Represents a rational number literal.
1.0r ^^^^
Attributes
numeric[R]
attr_reader numeric: Node
Public Class Methods
Public Instance Methods
accept(visitor)
click to toggle source
def accept: (visitor: Visitor
) -> void
# File yarp/node.rb, line 8780 def accept(visitor) visitor.visit_rational_node(self) end
child_nodes()
click to toggle source
def child_nodes
: () -> Array[nil | Node]
# File yarp/node.rb, line 8785 def child_nodes [numeric] end
Also aliased as: deconstruct
comment_targets()
click to toggle source
def comment_targets
: () -> Array[Node | Location]
# File yarp/node.rb, line 8790 def comment_targets [numeric] end
copy(**params)
click to toggle source
def copy: (**params) -> RationalNode
# File yarp/node.rb, line 8795 def copy(**params) RationalNode.new( params.fetch(:numeric) { numeric }, params.fetch(:location) { location }, ) end
deconstruct_keys(keys)
click to toggle source
inspect(inspector = NodeInspector.new)
click to toggle source
# File yarp/node.rb, line 8810 def inspect(inspector = NodeInspector.new) inspector << inspector.header(self) inspector << "└── numeric:\n" inspector << inspector.child_node(numeric, " ") inspector.to_str end
value()
click to toggle source
Returns the value of the node as a Ruby Rational.
# File yarp.rb, line 604 def value Rational(slice.chomp("r")) end