diff --git a/guides/source/active_support_core_extensions.textile b/guides/source/active_support_core_extensions.textile index 011a702901..ad3024d30d 100644 --- a/guides/source/active_support_core_extensions.textile +++ b/guides/source/active_support_core_extensions.textile @@ -1857,6 +1857,7 @@ h4. Formatting Enables the formatting of numbers in a variety of ways. Produce a string representation of a number as a telephone number: + 5551234.to_s(:phone) # => 555-1234 1235551234.to_s(:phone) # => 123-555-1234 @@ -1867,6 +1868,7 @@ Produce a string representation of a number as a telephone number: Produce a string representation of a number as currency: + 1234567890.50.to_s(:currency) # => $1,234,567,890.50 1234567890.506.to_s(:currency) # => $1,234,567,890.51 @@ -1874,6 +1876,7 @@ Produce a string representation of a number as currency: Produce a string representation of a number as a percentage: + 100.to_s(:percentage) # => 100.000% 100.to_s(:percentage, :precision => 0) # => 100% @@ -1882,6 +1885,7 @@ Produce a string representation of a number as a percentage: Produce a string representation of a number in delimited form: + 12345678.to_s(:delimited) # => 12,345,678 12345678.05.to_s(:delimited) # => 12,345,678.05 @@ -1891,6 +1895,7 @@ Produce a string representation of a number in delimited form: Produce a string representation of a number rounded to a precision: + 111.2345.to_s(:rounded) # => 111.235 111.2345.to_s(:rounded, :precision => 2) # => 111.23 @@ -1900,6 +1905,7 @@ Produce a string representation of a number rounded to a precision: Produce a string representation of a number as a human-readable number of bytes: + 123.to_s(:human_size) # => 123 Bytes 1234.to_s(:human_size) # => 1.21 KB @@ -1910,6 +1916,7 @@ Produce a string representation of a number as a human-readable number of bytes: Produce a string representation of a number in human-readable words: + 123.to_s(:human) # => "123" 1234.to_s(:human) # => "1.23 Thousand" @@ -2469,6 +2476,7 @@ To do so, the method loops over the pairs and builds nodes that depend on the _v * If +value+ responds to +to_xml+ the method is invoked with +key+ as :root. * Otherwise, a node with +key+ as tag is created with a string representation of +value+ as text node. If +value+ is +nil+ an attribute "nil" set to "true" is added. Unless the option :skip_types exists and is true, an attribute "type" is added as well according to the following mapping: + XML_TYPE_NAMES = { "Symbol" => "symbol",