Skip to content
This repository
Browse code

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
  • Loading branch information...
commit 400c5fefcf6d3cca734b32fa6a9c93ce338602ea 1 parent f9cb645
Carlos Antonio da Silva authored May 28, 2012
5  actionpack/lib/action_view/helpers/number_helper.rb
... ...
@@ -1,8 +1,6 @@
1 1
 # encoding: utf-8
2 2
 
3  
-require 'active_support/core_ext/big_decimal/conversions'
4  
-require 'active_support/core_ext/object/blank'
5  
-require 'active_support/core_ext/numeric'
  3
+require 'active_support/core_ext/hash/keys'
6 4
 require 'active_support/core_ext/string/output_safety'
7 5
 require 'active_support/number_helper'
8 6
 
@@ -10,7 +8,6 @@ module ActionView
10 8
   # = Action View Number Helpers
11 9
   module Helpers #:nodoc:
12 10
 
13  
-
14 11
     # Provides methods for converting numbers into formatted strings.
15 12
     # Methods are provided for phone numbers, currency, percentage,
16 13
     # precision, positional notation, file size and pretty printing.
12  activesupport/lib/active_support/core_ext/numeric/conversions.rb
@@ -2,7 +2,7 @@
2 2
 require 'active_support/number_helper'
3 3
 
4 4
 class Numeric
5  
-  
  5
+
6 6
   # Provides options for converting numbers into formatted strings.
7 7
   # Options are provided for phone numbers, currency, percentage,
8 8
   # precision, positional notation, file size and pretty printing.
@@ -97,7 +97,7 @@ class Numeric
97 97
   #  1234567.to_s(:human, :precision => 1,
98 98
   #                   :separator => ',',
99 99
   #                   :significant => false)                   # => "1,2 Million"
100  
-  def to_formatted_s(format = :default, options = {})    
  100
+  def to_formatted_s(format = :default, options = {})
101 101
     case format
102 102
     when :phone
103 103
       return ActiveSupport::NumberHelper.number_to_phone(self, options)
@@ -117,19 +117,19 @@ def to_formatted_s(format = :default, options = {})
117 117
       self.to_default_s
118 118
     end
119 119
   end
120  
-  
  120
+
121 121
   [Float, Fixnum, Bignum, BigDecimal].each do |klass|
122 122
     klass.send(:alias_method, :to_default_s, :to_s)
123  
-    
  123
+
124 124
     klass.send(:define_method, :to_s) do |*args|
125 125
       if args[0].is_a?(Symbol)
126 126
         format = args[0]
127 127
         options = args[1] || {}
128  
-        
  128
+
129 129
         self.to_formatted_s(format, options)
130 130
       else
131 131
         to_default_s(*args)
132 132
       end
133 133
     end
134 134
   end
135  
-end
  135
+end
9  activesupport/lib/active_support/number_helper.rb
@@ -498,14 +498,13 @@ def number_to_human(number, options = {})
498 498
       formatted_number = self.number_to_rounded(number, options)
499 499
       decimal_format.gsub(/%n/, formatted_number).gsub(/%u/, unit).strip
500 500
     end
501  
-    
502  
-    
  501
+
503 502
     def self.private_module_and_instance_method(method_name)
504 503
       private method_name
505 504
       private_class_method method_name
506 505
     end
507 506
     private_class_method :private_module_and_instance_method
508  
-      
  507
+
509 508
     def format_translations(namespace, locale)
510 509
       defaults_translations(locale).merge(translations_for(namespace, locale))
511 510
     end
@@ -527,6 +526,6 @@ def valid_float?(number)
527 526
       false
528 527
     end
529 528
     private_module_and_instance_method :valid_float?
530  
-    
  529
+
531 530
   end
532  
-end
  531
+end

0 notes on commit 400c5fe

Please sign in to comment.
Something went wrong with that request. Please try again.