Class: Unparser::Preprocessor::Infinity
- Inherits:
-
Unparser::Preprocessor
- Object
- Unparser::Preprocessor
- Unparser::Preprocessor::Infinity
- Defined in:
- lib/unparser/preprocessor.rb
Overview
Preprocessor transforming numeric nodes with infinity as value to round trippable equivalent.
Constant Summary collapse
- NEG_INFINITY =
- 1)
Constants inherited from Unparser::Preprocessor
Instance Method Summary collapse
-
#result ⇒ Parser::AST::Node
private
Return preprocessor result.
Methods inherited from Unparser::Preprocessor
Methods included from NodeHelpers
Instance Method Details
#result ⇒ Parser::AST::Node
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return preprocessor result
121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/unparser/preprocessor.rb', line 121 def result value = node.children.first case value when Float::INFINITY s(:const, s(:const, nil, :Float), :INFINITY) when NEG_INFINITY s(:send, s(:const, s(:const, nil, :Float), :INFINITY), :-@) else node end end |