number_to_phone

number_to_phone(number, options = {}) Instance Public methods Formats a number into a US phone number (e.g., (555) 123-9876). You can customize the format in the options hash. Options :area_code - Adds parentheses around the area code. :delimiter - Specifies the delimiter to use (defaults to â-â). :extension - Specifies an extension to add to the end of the generated number. :country_code - Sets the country code for the phone number. :raise - If true, raises InvalidNumberE

number_to_percentage

number_to_percentage(number, options = {}) Instance Public methods Formats a number as a percentage string (e.g., 65%). You can customize the format in the options hash. Options :locale - Sets the locale to be used for formatting (defaults to current locale). :precision - Sets the precision of the number (defaults to 3). :significant - If true, precision will be the # of significant_digits. If false, the # of fractional digits (defaults to false). :separator - Sets the separ

number_to_human_size

number_to_human_size(number, options = {}) Instance Public methods Formats the bytes in number into a more understandable representation (e.g., giving it 1500 yields 1.5 KB). This method is useful for reporting file sizes to users. You can customize the format in the options hash. See number_to_human if you want to pretty-print a generic number. Options :locale - Sets the locale to be used for formatting (defaults to current locale). :precision - Sets the precision of the number

number_to_human

number_to_human(number, options = {}) Instance Public methods Pretty prints (formats and approximates) a number in a way it is more readable by humans (eg.: 1200000000 becomes â1.2 Billionâ). This is useful for numbers that can get very large (and too hard to read). See number_to_human_size if you want to print a file size. You can also define you own unit-quantifier names if you want to use other decimal units (eg.: 1500 becomes â1.5 kilometersâ, 0.150 becomes â150 millilitersâ, e

number_to_currency

number_to_currency(number, options = {}) Instance Public methods Formats a number into a currency string (e.g., $13.65). You can customize the format in the options hash. Options :locale - Sets the locale to be used for formatting (defaults to current locale). :precision - Sets the level of precision (defaults to 2). :unit - Sets the denomination of the currency (defaults to â$â). :separator - Sets the separator between the units (defaults to â.â). :delimiter - Sets the th

new

new(number) Class Public methods

javascript_tag

javascript_tag(content_or_options_with_block = nil, html_options = {}, &block) Instance Public methods Returns a JavaScript tag with the content inside. Example: javascript_tag "alert('All is good')" Returns: <script> //<![CDATA[ alert('All is good') //]]> </script> html_options may be a hash of attributes for the <script> tag. javascript_tag "alert('All is good')", defer: 'defer' # => <script defer="defer">alert('All is good')</script>

j

j(javascript) Instance Public methods Alias for: escape_javascript

escape_javascript

escape_javascript(javascript) Instance Public methods Escapes carriage returns and single and double quotes for JavaScript segments. Also available through the alias j(). This is particularly helpful in JavaScript responses, like: $('some_element').replaceWith('<%=j render 'some/element_template' %>'); j

week_field_tag

week_field_tag(name, value = nil, options = {}) Instance Public methods Creates a text field of type âweekâ. Options :min - The minimum acceptable value. :max - The maximum acceptable value. :step - The acceptable value granularity. Otherwise accepts the same options as text_field_tag.