diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-05-28 23:48:05 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-05-28 23:55:20 -0300 |
commit | 400c5fefcf6d3cca734b32fa6a9c93ce338602ea (patch) | |
tree | ce8b972ca2b9853691e8f1b85f0e8d3a4e6019b0 /activesupport/lib/active_support/core_ext | |
parent | f9cb645dfcb5cc89f59d2f8b58a019486c828c73 (diff) | |
download | rails-400c5fefcf6d3cca734b32fa6a9c93ce338602ea.tar.gz rails-400c5fefcf6d3cca734b32fa6a9c93ce338602ea.tar.bz2 rails-400c5fefcf6d3cca734b32fa6a9c93ce338602ea.zip |
Review requires from number helper
Some of these requires are now only necessary in
ActiveSupport::NumberHelper. Add hash/keys require due to symbolize_keys
usage in number helpers. Also remove some whitespaces.
Closes #6414
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-rw-r--r-- | activesupport/lib/active_support/core_ext/numeric/conversions.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/core_ext/numeric/conversions.rb b/activesupport/lib/active_support/core_ext/numeric/conversions.rb index 2666387623..2bbfa78639 100644 --- a/activesupport/lib/active_support/core_ext/numeric/conversions.rb +++ b/activesupport/lib/active_support/core_ext/numeric/conversions.rb @@ -2,7 +2,7 @@ require 'active_support/core_ext/big_decimal/conversions' require 'active_support/number_helper' class Numeric - + # Provides options for converting numbers into formatted strings. # Options are provided for phone numbers, currency, percentage, # precision, positional notation, file size and pretty printing. @@ -97,7 +97,7 @@ class Numeric # 1234567.to_s(:human, :precision => 1, # :separator => ',', # :significant => false) # => "1,2 Million" - def to_formatted_s(format = :default, options = {}) + def to_formatted_s(format = :default, options = {}) case format when :phone return ActiveSupport::NumberHelper.number_to_phone(self, options) @@ -117,19 +117,19 @@ class Numeric self.to_default_s end end - + [Float, Fixnum, Bignum, BigDecimal].each do |klass| klass.send(:alias_method, :to_default_s, :to_s) - + klass.send(:define_method, :to_s) do |*args| if args[0].is_a?(Symbol) format = args[0] options = args[1] || {} - + self.to_formatted_s(format, options) else to_default_s(*args) end end end -end
\ No newline at end of file +end |