Commit Graph

10 Commits

Author SHA1 Message Date
hoffm
4e3ceedeba Address edge case for number_to_human with units option.
ActiveSupport::NumberHelper#number_to_human now returns the number unaltered when
the units hash does not contain the needed key, e.g. when the number provided is less
than the largest key provided.
2013-02-22 08:25:51 -05:00
Francesco Rodriguez
f4e180578c update some AS code examples to 1.9 hash syntax [ci skip] 2012-09-12 13:47:49 -05:00
Carlos Antonio da Silva
47b4d13c8d Ensure I18n format values always have precedence over defaults
Always merge I18n format values, namespaced or not, over the default
ones, to ensure I18n format defaults will have precedence over our
namespaced values.

Precedence should happen like this:

    default :format
    default :namespace :format
    i18n    :format
    i18n    :namespace :format

Because we cannot allow our namespaced default to override a I18n
:format config - ie precision in I18n :format should always have higher
precedence than our default precision for a particular :namespace.

Also simplify default format options logic.
2012-08-11 00:20:19 -03:00
Carlos Antonio da Silva
a9dccda936 Fallback to :en locale instead of handling a constant with defaults
Action Pack already comes with a default locale fine for :en, that is
always loaded. We can just fallback to this locale for defaults, if
values for the current locale cannot be found.

Closes #4420, #2802, #2890.
2012-08-11 00:20:19 -03:00
Carlos Antonio da Silva
36d863ce51 Move constants to the top, remove freeze 2012-06-24 19:30:05 -03:00
Carlos Antonio da Silva
06d50b9d73 Remove some not used variables and improve code a bit 2012-06-24 19:30:05 -03:00
Francesco Rodriguez
1790b234e4 add :nodoc: to AS::NumberHelper private methods [ci skip] 2012-06-05 15:53:20 -05:00
Carlos Antonio da Silva
400c5fefcf 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
2012-05-28 23:55:20 -03:00
Jared Beck
371508c240 Fix handling of negative zero in number_to_currency 2012-05-28 04:42:53 -04:00
Andrew Mutz
155cd5e6b5 Moving NumberHelpers from ActionView to ActiveSupport 2012-05-27 18:14:21 -07:00