Module: PSON::Pure::Generator::GeneratorMethods::Float

Defined in:
lib/puppet/external/pson/pure/generator.rb

Instance Method Summary collapse

Instance Method Details

#to_pson(state = nil) ⇒ Object

Returns a PSON string representation for this Float number.



323
324
325
326
327
328
329
330
331
332
333
# File 'lib/puppet/external/pson/pure/generator.rb', line 323

def to_pson(state = nil, *)
  if infinite? || nan?
    if !state || state.allow_nan?
      to_s
    else
      raise GeneratorError, "#{self} not allowed in PSON"
    end
  else
    to_s
  end
end