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 aequivalent.
Constant Summary collapse
- NEG_INFINITY =
- 1)
Constants inherited from Unparser::Preprocessor
Instance Method Summary collapse
-
#result ⇒ Object
Return preprocessor result.
Methods inherited from Unparser::Preprocessor
Methods included from NodeHelpers
Instance Method Details
#result ⇒ Object
Return preprocessor result
195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/unparser/preprocessor.rb', line 195 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 |