Class: Float

Inherits:
Object show all
Defined in:
lib/syck/rubytypes.rb

Instance Method Summary collapse

Instance Method Details

#to_yaml(opts = {}) ⇒ Object



382
383
384
385
386
387
388
389
390
391
392
393
394
395
# File 'lib/syck/rubytypes.rb', line 382

def to_yaml( opts = {} )
       return super unless YAML::ENGINE.syck?
	YAML::quick_emit( nil, opts ) do |out|
           str = self.to_s
           if str == "Infinity"
               str = ".Inf"
           elsif str == "-Infinity"
               str = "-.Inf"
           elsif str == "NaN"
               str = ".NaN"
           end
           out.scalar( "tag:yaml.org,2002:float", str, :plain )
       end
end