Methods

Class Index [+]

Quicksearch

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 335
335:           def to_json(state = nil, *)
336:             state = State.from_state(state)
337:             case
338:             when infinite?
339:               if state.allow_nan?
340:                 to_s
341:               else
342:                 raise GeneratorError, "#{self} not allowed in JSON"
343:               end
344:             when nan?
345:               if state.allow_nan?
346:                 to_s
347:               else
348:                 raise GeneratorError, "#{self} not allowed in JSON"
349:               end
350:             else
351:               to_s
352:             end
353:           end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.