Class: Transit::WriteHandlers::FloatHandler
- Inherits:
-
Object
- Object
- Transit::WriteHandlers::FloatHandler
- Defined in:
- lib/transit/write_handlers.rb
Instance Method Summary collapse
Instance Method Details
#rep(f) ⇒ Object
250 251 252 253 254 255 256 257 |
# File 'lib/transit/write_handlers.rb', line 250 def rep(f) return "NaN" if f.nan? case f when Float::INFINITY then "INF" when -Float::INFINITY then "-INF" else f end end |
#string_rep(f) ⇒ Object
259 |
# File 'lib/transit/write_handlers.rb', line 259 def string_rep(f) rep(f).to_s end |
#tag(f) ⇒ Object
240 241 242 243 244 245 246 247 248 |
# File 'lib/transit/write_handlers.rb', line 240 def tag(f) return "z" if f.nan? case f when Float::INFINITY, -Float::INFINITY "z" else "d" end end |