instance method to_yaml

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v2.3.18

Available in: v2.2.3 v2.3.18

Signature

to_yaml(opts = {})

This emits the number without any scientific notation. This is better than self.to_f.to_s since it doesn’t lose precision.

Note that reconstituting YAML floats to native floats may lose precision.

Parameters

opts opt = {}
Source
# File activesupport/lib/active_support/core_ext/bigdecimal/conversions.rb, line 28
        def to_yaml(opts = {})
          YAML.quick_emit(nil, opts) do |out|
            string = to_s
            out.scalar(YAML_TAG, YAML_MAPPING[string] || string, :plain)
          end
        end

Defined in activesupport/lib/active_support/core_ext/bigdecimal/conversions.rb line 28 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::CoreExtensions::BigDecimal::Conversions

Type at least 2 characters to search.

↑↓ navigate · open · esc close