to_json (JSON::Pure::Generator::GeneratorMethods::Float)

         # File lib/json/pure/generator.rb, line 352
    352:           def to_json(state = nil, *)
    353:             case
    354:             when infinite?
    355:               if !state || state.allow_nan?
    356:                 to_s
    357:               else
    358:                 raise GeneratorError, "#{self} not allowed in JSON"
    359:               end
    360:             when nan?
    361:               if !state || state.allow_nan?
    362:                 to_s
    363:               else
    364:                 raise GeneratorError, "#{self} not allowed in JSON"
    365:               end
    366:             else
    367:               to_s
    368:             end
    369:           end