Methods

Files

JSON::Pure::Generator::GeneratorMethods::Float

Public Instance Methods

to_json(state = nil, *) click to toggle source

Returns a JSON string representation for this Float number.

     # File lib/json/pure/generator.rb, line 368
368:           def to_json(state = nil, *)
369:             state = State.from_state(state)
370:             case
371:             when infinite?
372:               if state.allow_nan?
373:                 to_s
374:               else
375:                 raise GeneratorError, "#{self} not allowed in JSON"
376:               end
377:             when nan?
378:               if state.allow_nan?
379:                 to_s
380:               else
381:                 raise GeneratorError, "#{self} not allowed in JSON"
382:               end
383:             else
384:               to_s
385:             end
386:           end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.