class Prism::RationalNode

Public Instance Methods

numeric ()

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

# File lib/prism/node_ext.rb, line 120
def numeric
  deprecated("value", "numerator", "denominator")

  if denominator == 1
    IntegerNode.new(source, -1, location.chop, flags, numerator)
  else
    FloatNode.new(source, -1, location.chop, 0, numerator.to_f / denominator)
  end
end
value ()

Returns the value of the node as a Ruby Rational.

# File lib/prism/node_ext.rb, line 114
def value
  Rational(numerator, denominator)
end