Class: Prism::RationalNode
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Node
|
|
Instance Chain:
self,
Node
|
|
Inherits: |
Prism::Node
|
Defined in: | lib/prism/node_ext.rb |
Instance Attribute Summary
Node
- Inherited
Instance Method Summary
-
#numeric
Returns the value of the node as an IntegerNode or a FloatNode.
-
#value
Returns the value of the node as a Ruby Rational.
Node
- Inherited
Instance Method Details
#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