Class/Module Index [+]

Quicksearch

ActiveSupport::CoreExtensions::BigDecimal::Conversions

Public Instance Methods

to_formatted_s(format = DEFAULT_STRING_FORMAT) click to toggle source
# File lib/active_support/core_ext/bigdecimal/conversions.rb, line 20
def to_formatted_s(format = DEFAULT_STRING_FORMAT)
  _original_to_s(format)
end
to_yaml(opts = {}) click to toggle source

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.

# File 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

[Validate]

Generated with the Darkfish Rdoc Generator 2.