Permalink
Browse files

Fixed spelling of delimiter #1058

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1134 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 2daf2c8 commit 5cd815addfe88e7a1f886b9722963d24343db4ed @dhh dhh committed Apr 10, 2005
Showing with 14 additions and 14 deletions.
  1. +14 −14 actionpack/lib/action_view/helpers/number_helper.rb
@@ -6,21 +6,21 @@ module NumberHelper
# Formats a +number+ into a US phone number string. The +options+ can be hash used to customize the format of the output.
# The area code can be surrounded by parenthesis by setting +:area_code+ to true; default is false
- # The delimeter can be set using +:delimter+; default is "-"
+ # The delimiter can be set using +:delimiter+; default is "-"
# Examples:
# number_to_phone(1235551234) => 123-555-1234
# number_to_phone(1235551234, {:area_code => true}) => (123) 555-1234
- # number_to_phone(1235551234, {:delimter => " "}) => 123 555 1234
+ # number_to_phone(1235551234, {:delimiter => " "}) => 123 555 1234
def number_to_phone(number, options = {})
options = options.stringify_keys
area_code = options.delete("area_code") { false }
- delimeter = options.delete("delimeter") { "-" }
+ delimiter = options.delete("delimiter") { "-" }
begin
str = number.to_s
if area_code == true
- str.gsub!(/([0-9]{3})([0-9]{3})([0-9]{4})/,"(\\1) \\2#{delimeter}\\3")
+ str.gsub!(/([0-9]{3})([0-9]{3})([0-9]{4})/,"(\\1) \\2#{delimiter}\\3")
else
- str.gsub!(/([0-9]{3})([0-9]{3})([0-9]{4})/,"\\1#{delimeter}\\2#{delimeter}\\3")
+ str.gsub!(/([0-9]{3})([0-9]{3})([0-9]{4})/,"\\1#{delimiter}\\2#{delimiter}\\3")
end
rescue
number
@@ -31,17 +31,17 @@ def number_to_phone(number, options = {})
# The +number+ can contain a level of precision using the +precision+ key; default is 2
# The currency type can be set using the +unit+ key; default is "$"
# The unit separator can be set using the +separator+ key; default is "."
- # The delimter can be set using the +delimeter+ key; default is ","
+ # The delimiter can be set using the +delimiter+ key; default is ","
# Examples:
# number_to_currency(1234567890.50) => $1,234,567,890.50
# number_to_currency(1234567890.506) => $1,234,567,890.51
- # number_to_currency(1234567890.50, {:unit => "£", :separator => ",", :delimeter => ""}) => £123456789,50
+ # number_to_currency(1234567890.50, {:unit => "£", :separator => ",", :delimiter => ""}) => £123456789,50
def number_to_currency(number, options = {})
options = options.stringify_keys
- precision, unit, separator, delimeter = options.delete("precision") { 2 }, options.delete("unit") { "$" }, options.delete("separator") { "." }, options.delete("delimeter") { "," }
+ precision, unit, separator, delimiter = options.delete("precision") { 2 }, options.delete("unit") { "$" }, options.delete("separator") { "." }, options.delete("delimiter") { "," }
begin
parts = number_with_precision(number, precision).split('.')
- unit + number_with_delimeter(parts[0]) + separator + parts[1].to_s
+ unit + number_with_delimiter(parts[0]) + separator + parts[1].to_s
rescue
number
end
@@ -70,11 +70,11 @@ def number_to_percentage(number, options = {})
end
end
- # Formats a +number+ with a +delimeter+.
+ # Formats a +number+ with a +delimiter+.
# Example:
- # number_with_delimeter(12345678) => 1,235,678
- def number_with_delimeter(number, delimeter=",")
- number.gsub(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{delimeter}")
+ # number_with_delimiter(12345678) => 1,235,678
+ def number_with_delimiter(number, delimiter=",")
+ number.gsub(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{delimiter}")
end
# Formats a +number+ with a level of +precision+.
@@ -85,4 +85,4 @@ def number_with_precision(number, precision=3)
end
end
end
-end
+end

0 comments on commit 5cd815a

Please sign in to comment.