HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/gems/default/doc/activesupport-6.1.4.1/ri/ActiveSupport/NumericWithFormat/to_s-i.ri
U:RDoc::AnyMethod[iI"	to_s:ETI"*ActiveSupport::NumericWithFormat#to_s;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph;	[I"EProvides options for converting numbers into formatted strings. ;TI"COptions are provided for phone numbers, currency, percentage, ;TI"Cprecision, positional notation, file size and pretty printing.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading:
leveli	:	textI"Options;T@o;
;	[I"TFor details on which formats use which options, see ActiveSupport::NumberHelper;T@S;;
i	;I"
Examples;T@o:RDoc::Markup::Verbatim;	[`I"Phone Numbers:
;TI"N5551234.to_s(:phone)                                     # => "555-1234"
;TI"R1235551234.to_s(:phone)                                  # => "123-555-1234"
;TI"T1235551234.to_s(:phone, area_code: true)                 # => "(123) 555-1234"
;TI"R1235551234.to_s(:phone, delimiter: ' ')                  # => "123 555 1234"
;TI"Z1235551234.to_s(:phone, area_code: true, extension: 555) # => "(123) 555-1234 x 555"
;TI"U1235551234.to_s(:phone, country_code: 1)                 # => "+1-123-555-1234"
;TI"O1235551234.to_s(:phone, country_code: 1, extension: 1343, delimiter: '.')
;TI"## => "+1.123.555.1234 x 1343"
;TI"
;TI"Currency:
;TI"P1234567890.50.to_s(:currency)                     # => "$1,234,567,890.50"
;TI"P1234567890.506.to_s(:currency)                    # => "$1,234,567,890.51"
;TI"Q1234567890.506.to_s(:currency, precision: 3)      # => "$1,234,567,890.506"
;TI"P1234567890.506.to_s(:currency, round_mode: :down) # => "$1,234,567,890.50"
;TI"S1234567890.506.to_s(:currency, locale: :fr)       # => "1 234 567 890,51 €"
;TI"?-1234567890.50.to_s(:currency, negative_format: '(%u%n)')
;TI" # => "($1,234,567,890.50)"
;TI"S1234567890.50.to_s(:currency, unit: '£', separator: ',', delimiter: '')
;TI"!# => "£1234567890,50"
;TI"d1234567890.50.to_s(:currency, unit: '£', separator: ',', delimiter: '', format: '%n %u')
;TI""# => "1234567890,50 £"
;TI"
;TI"Percentage:
;TI"L100.to_s(:percentage)                                  # => "100.000%"
;TI"H100.to_s(:percentage, precision: 0)                    # => "100%"
;TI"N1000.to_s(:percentage, delimiter: '.', separator: ',') # => "1.000,000%"
;TI"N302.24398923423.to_s(:percentage, precision: 5)        # => "302.24399%"
;TI"L302.24398923423.to_s(:percentage, round_mode: :down)   # => "302.243%"
;TI"N1000.to_s(:percentage, locale: :fr)                    # => "1 000,000%"
;TI"N100.to_s(:percentage, format: '%n  %')                 # => "100.000  %"
;TI"
;TI"Delimited:
;TI"E12345678.to_s(:delimited)                     # => "12,345,678"
;TI"H12345678.05.to_s(:delimited)                  # => "12,345,678.05"
;TI"E12345678.to_s(:delimited, delimiter: '.')     # => "12.345.678"
;TI"E12345678.to_s(:delimited, delimiter: ',')     # => "12,345,678"
;TI"H12345678.05.to_s(:delimited, separator: ' ')  # => "12,345,678 05"
;TI"H12345678.05.to_s(:delimited, locale: :fr)     # => "12 345 678,05"
;TI"B98765432.98.to_s(:delimited, delimiter: ' ', separator: ',')
;TI"# => "98 765 432,98"
;TI"
;TI"Rounded:
;TI"Q111.2345.to_s(:rounded)                                      # => "111.235"
;TI"P111.2345.to_s(:rounded, precision: 2)                        # => "111.23"
;TI"P111.2345.to_s(:rounded, precision: 2, round_mode: :up)       # => "111.24"
;TI"R13.to_s(:rounded, precision: 5)                              # => "13.00000"
;TI"M389.32314.to_s(:rounded, precision: 0)                       # => "389"
;TI"M111.2345.to_s(:rounded, significant: true)                   # => "111"
;TI"M111.2345.to_s(:rounded, precision: 1, significant: true)     # => "100"
;TI"P13.to_s(:rounded, precision: 5, significant: true)           # => "13.000"
;TI"Q111.234.to_s(:rounded, locale: :fr)                          # => "111,234"
;TI"Y13.to_s(:rounded, precision: 5, significant: true, strip_insignificant_zeros: true)
;TI"# => "13"
;TI"O389.32314.to_s(:rounded, precision: 4, significant: true)    # => "389.3"
;TI"L1111.2345.to_s(:rounded, precision: 2, separator: ',', delimiter: '.')
;TI"# => "1.111,23"
;TI"
;TI"#Human-friendly size in Bytes:
;TI"O123.to_s(:human_size)                                    # => "123 Bytes"
;TI"M1234.to_s(:human_size)                                   # => "1.21 KB"
;TI"M12345.to_s(:human_size)                                  # => "12.1 KB"
;TI"M1234567.to_s(:human_size)                                # => "1.18 MB"
;TI"M1234567890.to_s(:human_size)                             # => "1.15 GB"
;TI"M1234567890123.to_s(:human_size)                          # => "1.12 TB"
;TI"L1234567890123456.to_s(:human_size)                       # => "1.1 PB"
;TI"M1234567890123456789.to_s(:human_size)                    # => "1.07 EB"
;TI"L1234567.to_s(:human_size, precision: 2)                  # => "1.2 MB"
;TI"L1234567.to_s(:human_size, precision: 2, round_mode: :up) # => "1.3 MB"
;TI"L483989.to_s(:human_size, precision: 2)                   # => "470 KB"
;TI"L1234567.to_s(:human_size, precision: 2, separator: ',')  # => "1,2 MB"
;TI"O1234567890123.to_s(:human_size, precision: 5)            # => "1.1228 TB"
;TI"L524288000.to_s(:human_size, precision: 5)                # => "500 MB"
;TI"
;TI"Human-friendly format:
;TI"G123.to_s(:human)                                       # => "123"
;TI"Q1234.to_s(:human)                                      # => "1.23 Thousand"
;TI"Q12345.to_s(:human)                                     # => "12.3 Thousand"
;TI"P1234567.to_s(:human)                                   # => "1.23 Million"
;TI"P1234567890.to_s(:human)                                # => "1.23 Billion"
;TI"Q1234567890123.to_s(:human)                             # => "1.23 Trillion"
;TI"T1234567890123456.to_s(:human)                          # => "1.23 Quadrillion"
;TI"T1234567890123456789.to_s(:human)                       # => "1230 Quadrillion"
;TI"P489939.to_s(:human, precision: 2)                      # => "490 Thousand"
;TI"P489939.to_s(:human, precision: 2, round_mode: :down)   # => "480 Thousand"
;TI"R489939.to_s(:human, precision: 4)                      # => "489.9 Thousand"
;TI"(1234567.to_s(:human, precision: 4,
;TI"R                 significant: false)                   # => "1.2346 Million"
;TI"(1234567.to_s(:human, precision: 1,
;TI"&                 separator: ',',
;TI"N                 significant: false)                   # => "1,2 Million";T:@format0:
@fileI"7lib/active_support/core_ext/numeric/conversions.rb;T:0@omit_headings_from_table_of_contents_below000[I""(format = nil, options = nil);T@uTI"NumericWithFormat;TcRDoc::NormalModule00