Skip to content

Commit

Permalink
implicitly return nil if there is no number
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Oct 18, 2010
1 parent 98d3c41 commit a0a5a2a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions actionpack/lib/action_view/helpers/number_helper.rb
Expand Up @@ -102,7 +102,7 @@ def number_to_phone(number, options = {})
# number_to_currency(1234567890.50, :unit => "£", :separator => ",", :delimiter => "", :format => "%n %u")
# # => 1234567890,50 £
def number_to_currency(number, options = {})
return nil if number.nil?
return unless number

options.symbolize_keys!

Expand Down Expand Up @@ -147,7 +147,7 @@ def number_to_currency(number, options = {})
# number_to_percentage(302.24398923423, :precision => 5) # => 302.24399%
# number_to_percentage(1000, :locale => :fr) # => 1 000,000%
def number_to_percentage(number, options = {})
return nil if number.nil?
return unless number

options.symbolize_keys!

Expand Down

0 comments on commit a0a5a2a

Please sign in to comment.