| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`BigDecimal.new` has been deprecated in BigDecimal 1.3.3
which will be a default for Ruby 2.5.
Refer
https://github.com/ruby/bigdecimal/commit/533737338db915b00dc7168c3602e4b462b23503
* This commit has been made as follows:
```
cd rails
git grep -l BigDecimal.new | grep -v guides/source/5_0_release_notes.md | grep -v activesupport/test/xml_mini_test.rb | xargs sed -i -e "s/BigDecimal.new/BigDecimal/g"
```
- `activesupport/test/xml_mini_test.rb`
Editmanually to remove `.new` and `::`
- guides/source/5_0_release_notes.md
This is a Rails 5.0 release notes.
|
|
|
|
| |
These methods unused since 5533696.
|
|
|
|
| |
This basically reverts 8da30ad6be34339124ba4cb4e36aea260dda12bc
|
|
|
|
| |
`digits_and_rounded_number` is unused since #26628
|
| |
|
| |
|
|\ |
|
| |
| |
| |
| |
| | |
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
|
| |\
| | |
| | |
| | | |
Enforce frozen string in Rubocop
|
| | | |
|
| |/
| |
| |
| |
| |
| |
| | |
The ActiveSupport test suite only passes currently if it uses the latest unreleased commits for dalli, and a patch for Builder:
https://github.com/tenderlove/builder/pull/6
Beyond that, all external dependencies (at least, to the extent they’re used by ActiveSupport) are happy, including Nokogiri as of 1.8.0.
|
|/ |
|
| |
|
|
|
|
| |
fixes #25664
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
|
|
|
| |
do the same string manipulation. This was we avoid the duplicate strings with freeze and append modifies existing string
|
|
|
|
| |
iteration of calling the helper. Eases on some memory bloat
|
|
|
|
|
|
|
|
|
|
|
|
| |
By default, this method formats US number. This commit extends its
functionality to format number for other countries with a custom regular
expression.
number_to_phone(18812345678, pattern: /(\d{3})(\d{4})(\d{4})/)
# => 188-1234-5678
The output phone number is divided into three groups, so the regexp
should also match three groups of numbers.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
- Instead of using `to_f.phase`, just use `to_f.negative`?.
- This change works same for all cases except when number is "-0.0".
-0.0.to_f.negative? => false
-0.0.to_f.phase? => pi
- So -0.0 will be treated as positive from now onwards.
- So this change reverts changes from https://github.com/rails/rails/pull/6512.
- But it should be acceptable as we could not find any currency which
supports negative zeros.
|
| |
|
|\
| |
| |
| | |
Round some numbers more humanely
|
| |
| |
| |
| | |
Fix #20869
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
user passed `options[:delimited_regex]` if available. Changed `DELIMITED_REGEX` to `DEFAULT)DELIMITED_REGEX` to signify what it means.
- Added tests for number to delimited and number to currency in both actionview and activesupport.
Changes
Changes
|
|/ |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
https://github.com/ruby/ruby/pull/579 - there is a new optimization
since ruby 2.2
Previously regexp patterns were faster (since a string was converted to
regexp underneath anyway). But now string patterns are faster and
better reflect the purpose.
Benchmark.ips do |bm|
bm.report('regexp') { 'this is ::a random string'.gsub(/::/, '/') }
bm.report('string') { 'this is ::a random string'.gsub('::', '/') }
bm.compare!
end
# string: 753724.4 i/s
# regexp: 501443.1 i/s - 1.50x slower
|
|
|
|
| |
Closes #19227.
|
| |
|
|
|
|
|
|
|
|
|
| |
Enable number_to_percentage to keep the number's precision by allowing :precision option value to be nil
Conflicts:
activesupport/CHANGELOG.md
activesupport/lib/active_support/number_helper.rb
activesupport/test/number_helper_test.rb
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Zero has one digit, but Math.log10(0) returns -Infinity. The method
needs to special-case zero.
The patch adds a regression test that is not clearly related to the
underlying issue because digit_count is private and has no coverage.
Gray area.
This bug was uncovered by 60062cf.
|
|
|
|
|
|
|
|
|
|
| |
:precision was incorrectly being applied to Rationals
before:
ActiveSupport::NumberHelper.number_to_rounded Rational(10, 3), precision: 2
=> "3.3"
after:
ActiveSupport::NumberHelper.number_to_rounded Rational(10, 3), precision: 2
=> "3.33"
|
|
|
|
|
|
| |
`ActiveSupport::SafeBuffer` values aren't mangled.
Fixes #15064
|
|
|
|
|
|
|
| |
Closes #14405.
This is a follow-up to 9e997e9039435617b6a844158f5437e97f6bc107 to restore
the documented behavior.
|
|
|
|
|
|
|
|
|
| |
before:
ActiveSupport::NumberHelper.number_to_rounded '3.14159', precision: 50
=> "3.14158999999999988261834005243144929409027099609375"
after:
ActiveSupport::NumberHelper.number_to_rounded '3.14159', precision: 50
=> "3.14159000000000000000000000000000000000000000000000"
|
|
|
|
| |
These classes are not meant to be public.
|
| |
|
|
|
|
|
|
|
| |
This reads a lot better, and we won't need to try start_with? for blank
delimiters.
Also rename method name to read better.
|
|
|
|
|
| |
The conversion without area code already changed the passed number in
place, so change the other method to do the same.
|