Class: Float
Instance Method Summary collapse
Instance Method Details
#to_yaml(opts = {}) ⇒ Object
368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/yaml/rubytypes.rb', line 368 def to_yaml( opts = {} ) 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 |