ActiveSupport::NumberHelper::NumberConverter
No documentation available for this class.
Constants
DEFAULTS = {\n# Used in number_to_delimited\n# These are also the defaults for 'currency', 'percentage', 'precision', and 'human'\nformat: {\n# Sets the separator between the units, for more precision (e.g. 1.0 / 2.0 == 0.5)\nseparator: ".",\n# Delimits thousands (e.g. 1,000,000 is a million) (always in groups of three)\ndelimiter: ",",\n# Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00)\nprecision: 3,\n# If set to true, precision will mean the number of significant digits instead\n# of the number of decimal digits (1234 with precision 2 becomes 1200, 1.23543 becomes 1.2)\nsignificant: false,\n# If set, the zeros after the decimal separator will always be stripped (eg.: 1.200 will be 1.2)\nstrip_insignificant_zeros: false\n},\n\n# Used in number_to_currency\ncurrency: {\nformat: {\nformat: "%u%n",\nnegative_format: "-%u%n",\nunit: "$",\n# These five are to override number.format and are optional\nseparator: ".",\ndelimiter: ",",\nprecision: 2,\nsignificant: false,\nstrip_insignificant_zeros: false\n}\n},\n\n# Used in number_to_percentage\npercentage: {\nformat: {\ndelimiter: "",\nformat: "%n%"\n}\n},\n\n# Used in number_to_rounded\nprecision: {\nformat: {\ndelimiter: ""\n}\n},\n\n# Used in number_to_human_size and number_to_human\nhuman: {\nformat: {\n# These five are to override number.format and are optional\ndelimiter: "",\nprecision: 3,\nsignificant: true,\nstrip_insignificant_zeros: true\n},\n# Used in number_to_human_size\nstorage_units: {\n# Storage units output formatting.\n# %u is the storage unit, %n is the number (default: 2 MB)\nformat: "%n %u",\nunits: {\nbyte: "Bytes",\nkb: "KB",\nmb: "MB",\ngb: "GB",\ntb: "TB"\n}\n},\n# Used in number_to_human\ndecimal_units: {\nformat: "%n %u",\n# Decimal units output formatting\n# By default we will only quantify some of the exponents\n# but the commented ones might be defined or overridden\n# by the user.\nunits: {\n# femto: Quadrillionth\n# pico: Trillionth\n# nano: Billionth\n# micro: Millionth\n# mili: Thousandth\n# centi: Hundredth\n# deci: Tenth\nunit: "",\n# ten:\n# one: Ten\n# other: Tens\n# hundred: Hundred\nthousand: "Thousand",\nmillion: "Million",\nbillion: "Billion",\ntrillion: "Trillion",\nquadrillion: "Quadrillion"\n}\n}\n}\n}
Attributes
| [R] | number |
| [R] | opts |
Files
- activesupport/lib/active_support/number_helper/number_converter.rb