aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | Deprecate the `LoggerSilence` constant:Edouard CHIN2018-10-023-12/+39
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | - I found this weird that the LoggerSilence wasn't using the `ActiveSupport` namespace (AFAIK all other classes have it). This PR deprecate the use of `LoggerSilence` for `ActiveSupport::LoggerSilence` instead.
* | | | Merge pull request #33058 from gmcgibbon/string_first_last_negative_deprecationRafael França2018-10-023-0/+30
|\ \ \ \ | | | | | | | | | | Add deprecation warning when String#first and String#last receive neg…
| * | | | Add deprecation warning when String#first and String#last receive negative ↵Gannon McGibbon2018-09-283-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | integers [Gannon McGibbon + Eric Turner]
* | | | | Fix spellings for 'unmarshall(ing/ed)' & 'marshall(ing/ed)'Sharang Dashputre2018-10-021-19/+19
| |_|_|/ |/| | |
* | | | Merge pull request #32031 from yahonda/remove_redundant_freezeRyuta Kamizono2018-10-0131-57/+57
|\ \ \ \ | | | | | | | | | | Add `Style/RedundantFreeze` to remove redudant `.freeze`
| * | | | Add `Style/RedundantFreeze` to remove redudant `.freeze`Yasuo Honda2018-09-2931-57/+57
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Rails 6.0 will support Ruby 2.4.1 or higher `# frozen_string_literal: true` magic comment is enough to make string object frozen. This magic comment is enabled by `Style/FrozenStringLiteralComment` cop. * Exclude these files not to auto correct false positive `Regexp#freeze` - 'actionpack/lib/action_dispatch/journey/router/utils.rb' - 'activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb' It has been fixed by https://github.com/rubocop-hq/rubocop/pull/6333 Once the newer version of RuboCop released and available at Code Climate these exclude entries should be removed. * Replace `String#freeze` with `String#-@` manually if explicit frozen string objects are required - 'actionpack/test/controller/test_case_test.rb' - 'activemodel/test/cases/type/string_test.rb' - 'activesupport/lib/active_support/core_ext/string/strip.rb' - 'activesupport/test/core_ext/string_ext_test.rb' - 'railties/test/generators/actions_test.rb'
* / / / Require the except hash extension before trying to alias itLachlan Sylvester2018-10-011-0/+1
|/ / /
* | | Fix HashWithIndifferentAccess#without bugAbraham Chan2018-09-283-0/+18
| | |
* | | LoggerSilence doesn't require concurrent:Edouard CHIN2018-09-282-1/+1
| | | | | | | | | | | | - LoggerThreadSafeLevel does nowaday since 2518bda97cbbcb33dc9a92e70d5b01c09e64d12d
* | | Handle more unsafe String methods (#33990)Janosch Müller2018-09-274-11/+102
| |/ |/| | | | | | | | | | | | | | | | | * Handle more unsafe String methods * Fix codeclimate issue * Revert stylistic change [Janosch Müller + Rafael Mendonça França]
* | Change the empty block style to have space inside of the blockRafael Mendonça França2018-09-2517-61/+61
| |
* | Merge pull request #33949 from sjain1107/no-private-defKasper Timm Hansen2018-09-231-13/+14
|\ \ | | | | | | Remove private def
| * | Remove private defSakshi Jain2018-09-231-13/+14
| | |
* | | Enable `Performance/UnfreezeString` copyuuji.yaginuma2018-09-2315-41/+41
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`. ```ruby # frozen_string_literal: true require "bundler/inline" gemfile(true) do source "https://rubygems.org" gem "benchmark-ips" end Benchmark.ips do |x| x.report('+@') { +"" } x.report('dup') { "".dup } x.compare! end ``` ``` $ ruby -v benchmark.rb ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] Warming up -------------------------------------- +@ 282.289k i/100ms dup 187.638k i/100ms Calculating ------------------------------------- +@ 6.775M (± 3.6%) i/s - 33.875M in 5.006253s dup 3.320M (± 2.2%) i/s - 16.700M in 5.032125s Comparison: +@: 6775299.3 i/s dup: 3320400.7 i/s - 2.04x slower ```
* | Switch to supports_cache_versioning? check to a class methodschneems2018-09-205-20/+10
| | | | | | | | | | - Moving the `supports_cache_versioning?` check to a class method. - Shorten the method doc. - Expand on the error message.
* | [close #33907] Error when using "recyclable" cache keys with a store that ↵schneems2018-09-205-0/+35
|/ | | | | | | | | | | | | | does not support it If you are using the "in cache versioning" also known as "recyclable cache keys" the cache store must be aware of this scheme, otherwise you will generate cache entries that never invalidate. This PR adds a check to the initialization process to ensure that if recyclable cache keys are being used via ``` config.active_record.cache_versioning = true ``` Then the cache store needs to show that it supports this versioning scheme. Cache stores can let Rails know that they support this scheme by adding a method `supports_in_cache_versioning?` and returning true.
* Merge pull request #33800 from aeroastro/feature/doc-change-for-blankXavier Noria2018-09-131-1/+1
|\ | | | | Improve API document on Object#blank?
| * Revert falsey with example reorderedTakumasa Ochi2018-09-141-2/+2
| |
| * Improve API document on Object#blank?Takumasa Ochi2018-09-061-2/+2
| | | | | | | | | | * Introduce `falsey` to represent both `nil` and `false`. * Keep consistent order between abstract description and examples.
* | Faster multiple_of? methodrigani2018-09-121-1/+1
| |
* | Merge pull request #27792 from tjoyal/sandbox-tagged-loggingRafael Mendonça França2018-09-113-10/+35
|\ \ | | | | | | | | | TaggedLogging to return a new logger instance
| * | TaggedLogging to return a new logger instanceThierry Joyal2017-02-273-10/+34
| | |
* | | use "minitest" consistentlyXavier Noria2018-09-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | The name of the minitest library is spelled that way: regular font, and lowercase. Lowercase is used even at the beginning of sentences, see http://docs.seattlerb.org/minitest/ I double-checked this with @zenspider too (thanks!).
* | | Oxford comma [ci skip]Xavier Noria2018-09-101-1/+1
| | | | | | | | | | | | | | | Followup to a recently merged PR, too minor and detailed to require a modification to the contributed patch.
* | | Add #unfreeze_time to ActiveSupport::Testing::TimeHelpersryanwhocodes2018-09-103-1/+12
| | |
* | | reflect c03bba4 in CHANGELOGsXavier Noria2018-09-081-0/+9
| | |
* | | trace autoloads, and document hints for troubleshootingXavier Noria2018-09-072-4/+70
| | | | | | | | | | | | Closes #32885.
* | | Formatting CHANGELOGs [ci skip]Ryuta Kamizono2018-09-071-4/+4
| | | | | | | | | | | | Fixing code block rendering, indentation, backticks, etc.
* | | Merge pull request #33808 from itsbagpack/fix-access-safety-buffer-sliceAaron Patterson2018-09-063-3/+20
|\ \ \ | | | | | | | | Maintain html_safe? on sliced HTML safe strings
| * | | Update CHANGELOG for SafetyBuffer slice accessYumin Wong2018-09-061-0/+7
| | | | | | | | | | | | | | | | Co-authored-by: no-itsbackpack <no-itsbackpack@github.com>
| * | | Use assert_predicate insteadYumin Wong2018-09-061-2/+2
| | | | | | | | | | | | | | | | Co-authored-by: no-itsbackpack <no-itsbackpack@github.com>
| * | | SafeBuffer should maintain safety upon getting a slice via a range if ↵Yumin Wong2018-08-312-3/+13
| | |/ | |/| | | | | | | | | | | | | original buffer was safe. Co-Authored-By: no-itsbackpack <no-itsbackpack@github.com>
* | | Fix typo in i18n_railtie.rbOlivier2018-09-061-1/+1
| | |
* | | Merge pull request #33805 from schneems/schneems/faster-file-storeRichard Schneeman2018-09-061-6/+10
|\ \ \ | | | | | | | | Faster File Store
| * | | Faster File Storeschneems2018-09-061-6/+10
| |/ / | | | | | | | | | | | | | | | Memory before 1826584.8 memory after: 1797795.6 difference: 1.58% memory (speed) savings. When the key is not longer than the limit we can avoid allocating two strings and an array.
* | | Merge pull request #33574 from ↵Rafael França2018-09-061-1/+13
|\ \ \ | | | | | | | | | | | | | | | | lsylvester/change-i18n-defaults-behaviour-to-match-i18n-1.1.0 update I18n fallbacks configuration to be compatible with i18n 1.1.0
| * | | update I18n fallbacks configuration to be compatible with i18n 1.1.0Lachlan Sylvester2018-08-231-1/+13
| | | |
* | | | Ensure we always cleanup the databasesEileen Uchitelle2018-09-051-11/+13
| |/ / |/| | | | | | | | | | | | | | This commit moves the `run_cleanup` hook into an `ensure` block so we make sure to cleanup the databases even if an exception is raised while running the parallel tests.
* | | Remove redundant `travel_back`yuuji.yaginuma2018-08-311-5/+0
| | | | | | | | | | | | Since #29860, `travel_back` automatically called at the end of the test.
* | | 20% faster `try`Sean Griffin2018-08-291-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Following up on #33747, this takes things a step further by pulling out the method name from the arguments array, letting us skip an allocation in the case where there are no arguments -- notably, this also no longer *requires* the splat to be an array, allowing us to benefit from optimizations in Jruby (and maybe MRI in the future) of skipping the array allocation entirely. Benchmark results: ``` Warming up -------------------------------------- old 179.987k i/100ms new 199.201k i/100ms Calculating ------------------------------------- old 3.029M (± 1.6%) i/s - 15.299M in 5.052417s new 3.657M (± 1.2%) i/s - 18.326M in 5.012648s Comparison: new: 3656620.7 i/s old: 3028848.3 i/s - 1.21x slower ```
* | | Merge pull request #33747 from schneems/schneems/faster-tryRichard Schneeman2018-08-291-1/+10
|\ \ \ | | | | | | | | 32% Faster Object#try
| * | | 32% Faster Object#tryschneems2018-08-291-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Here’s the micro benchmark: ```ruby module ActiveSupport module NewTryable #:nodoc: def try(*a, &b) return unless a.empty? || respond_to?(a.first) return public_send(*a, &b) unless a.empty? return nil unless block_given? return instance_eval(&b) if b.arity == 0 yield self end def try!(*a, &b) return public_send(*a, &b) if !a.empty? return nil unless block_given? return instance_eval(&b) if b.arity == 0 yield self end end end module ActiveSupport module OldTryable #:nodoc: def try(*a, &b) try!(*a, &b) if a.empty? || respond_to?(a.first) end def try!(*a, &b) if a.empty? && block_given? if b.arity == 0 instance_eval(&b) else yield self end else public_send(*a, &b) end end end end class FooNew include ActiveSupport::NewTryable def foo end end class FooOld include ActiveSupport::OldTryable def foo end end foo_new = FooNew.new foo_old = FooOld.new require 'benchmark/ips' Benchmark.ips do |x| x.report("old") { foo_old.try(:foo) } x.report("new") { foo_new.try(:foo) } x.compare! end # Warming up -------------------------------------- # old 144.178k i/100ms # new 172.371k i/100ms # Calculating ------------------------------------- # old 2.181M (± 8.0%) i/s - 10.813M in 5.001419s # new 2.889M (± 7.7%) i/s - 14.479M in 5.051760s # Comparison: # new: 2888691.7 i/s # old: 2180740.7 i/s - 1.32x slower ``` Also reduces memory. On https://www.codetriage.com i’m seeing 1.5% fewer object allocations per request (in object count). Before: Total allocated: 1014475 bytes (8525 objects) After: Total allocated: 1015499 bytes (8389 objects)
* | | | Update the comments for TimeWithZone subtraction (#33721)Rob Race2018-08-281-2/+10
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update the comments for TimeWithZone subtraction While reading the description/documentation comments for the subtraction method, it was confusing. While in practical usage, the returned values make sense. It seems as though the explanation could be a bit clearer. * Removed erroneous closing parenthesis [ci skip] [Rob Race + Ryuta Kamizono]
* | | Merge pull request #33162 from utilum/stop_using_mochaKasper Timm Hansen2018-08-222-0/+112
|\ \ \ | |/ / |/| | Stop using Mocha
| * | Add method_call_assertions and use them instead of Mochautilum2018-08-132-0/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Six Mocha calls prove quite resistant to Minitestification. For example, if we replace ``` ActiveRecord::Associations::HasManyAssociation .any_instance .expects(:reader) .never ``` with `assert_not_called`, Minitest wisely raises ``` NameError: undefined method `reader' for class `ActiveRecord::Associations::HasManyAssociation' ``` as `:reader` comes from a deeply embedded abstract class, `ActiveRecord::Associations::CollectionAssociation`. This patch tackles this difficulty by adding `ActiveSupport::Testing::MethodCallAsserts#assert_called_on_instance_of` which injects a stubbed method into `klass`, and verifies the number of times it is called, similar to `assert_called`. It also adds a convenience method, `assert_not_called_on_instance_of`, mirroring `assert_not_called`. It uses the new method_call_assertions to replace the remaining Mocha calls in `ActiveRecord` tests. [utilum + bogdanvlviv + kspath]
* | | Improve documentation of Procs as :if / :unless options for callbacksFabian Schwahn2018-08-201-0/+8
| | |
* | | Merge pull request #31132 from ↵Ryuta Kamizono2018-08-201-0/+5
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | emaxi/feature/add-missing-documentation-option-to-number-to-currency Add missing documentation option to number_to_currency [ci skip]
| * | | Add missing documentation options to number_to_currency [ci skip]emaxi2018-07-111-0/+5
| | | |
* | | | Remove unused requiresyuuji.yaginuma2018-08-171-3/+0
| | | |
* | | | Fix obsoleted method URI.unescape in activesupport/testVitor Oliveira2018-08-151-1/+1
| | | |