aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | clarify role of unique_id in ActiveSupport::Notificationszvkemp2018-10-051-2/+2
| | | | |
* | | | | Deprecate ActionDispatch::Http::ParameterFilter in favor of ↵Yoshiyuki Kinjo2018-10-083-0/+161
| | | | | | | | | | | | | | | | | | | | ActiveSupport::ParameterFilter
* | | | | Array with single item correctly uses cache_keyGraham Turner2018-10-052-1/+50
|/ / / /
* | | | Merge pull request #34068 from schneems/schneems/micro-optimize-try-nilRichard Schneeman2018-10-051-2/+2
|\ \ \ \ | | | | | | | | | | 23% faster Nil#try
| * | | | This PR speeds up Nil#try by avoiding an allocation when only one argument ↵schneems2018-10-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | is passed: ```ruby class FooNew def try(method_name = nil, *args) nil end end class FooOld def try(*args) nil end end require 'benchmark/ips' foo_new = FooNew.new foo_old = FooOld.new Benchmark.ips do |x| x.report("new") { foo_new.try(:anything) } x.report("old") { foo_old.try(:anything) } x.compare! end # Warming up -------------------------------------- # new 250.633k i/100ms # old 232.322k i/100ms # Calculating ------------------------------------- # new 6.476M (± 4.8%) i/s - 32.332M in 5.005777s # old 5.258M (± 3.2%) i/s - 26.485M in 5.042589s # Comparison: # new: 6476002.5 i/s # old: 5257912.5 i/s - 1.23x slower ``` It's worth noting that checking for nil separately as in https://github.com/rails/rails/pull/34067 seems to be MUCH faster. It might be worth it to apply a blanket `&.` to every internal `try` call.
* | | | | Bugfix: ActiveSupport::EncryptedConfiguration reading of comment-only ↵Martin Spickermann2018-10-052-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | encrypted files (#34014) * Fix reading comment only encrypted files When a encrypted file contains only comments then reading that files raises an error: NoMethodError: undefined method `deep_symbolize_keys' for false:FalseClass activesupport/lib/active_support/encrypted_configuration.rb:33:in `config' test/encrypted_configuration_test.rb:52:in `block in <class:EncryptedConfigurationTest>' This happens because the previous implementation returned a `{}` fallback for blank YAML strings. But it did not handle YAML strings that are present but still do not contain any _usefull_ YAML - like the file created by `Rails::Generators::EncryptedFileGenerator` which looks like this: # aws: # access_key_id: 123 # secret_access_key: 345 * Fix coding style violation * Add backwardscompatible with Psych versions that were shipped with Ruby <2.5 * Do not rely on railties for Active Support test * Simplify error handling * Improve test naming * Simplify file creation in test
* | | | | Merge pull request #33936 from schneems/schneems/cache-micro-optimizationsRichard Schneeman2018-10-041-2/+6
|\ \ \ \ \ | | | | | | | | | | | | Decrease memory allocations in cache.rb
| * | | | | Decrease memory allocations in cache.rbschneems2018-09-211-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `merged_options` method is private and the output is never mutated. Using this info we can get rid of the `dup` behavior. We can also eliminate the `merge` call in the case where all the options being merged are the same. Returned results are frozen as an extra layer of protection against mutation. Before ``` Total allocated: 741749 bytes (6642 objects) ``` After ``` Total allocated: 734039 bytes (6648 objects) ``` Diff ``` (741749 - 734039) / 741749.0 => ~ 1.0 % ``` If you don't feel comfortable modifying this method, we could rename it and only use it internally.
* | | | | | Don't use deprecated `LoggerSilence`yuuji.yaginuma2018-10-041-1/+1
| | | | | |
* | | | | | Merge pull request #34055 from Edouard-chin/ec-logger-fixRafael França2018-10-035-20/+64
|\ \ \ \ \ \ | | | | | | | | | | | | | | Fix the LoggerSilence to work as described:
| * | | | | | Fix the LoggerSilence to work as described:Edouard CHIN2018-10-025-20/+64
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Following the Rails guide which state that a logger needs to include the `ActiveSupport::LoggerSilence` as well as `ActiveSupport::LoggerThreadSafe` modules isn't enough and won't work. Here is a test cases with 3 tests that all fails https://gist.github.com/Edouard-chin/4a72930c2b1eafbbd72a80c66f102010 The problems are the following: 1) The logger needs to call `after_initialize` in order to setup some instance variables. 2) The silence doesn't actually work because the bare ruby Logger `add` method checks for the instance variable `@logger`. We need to override the `add` (like we used to in the ActiveSupport::Logger class). 3) Calling `debug?` `info?` etc... doesn't work as the bare ruby methods will check for the instance variable. Again we need to override this methods (like we used to in the ActiveSupport::Logger class) The LoggerSilence won't work without LoggerThreadSafe, but the later is not public API, the user shouldn't have to include it so I modified to include it automatically. Same for the `after_initialize` method. I find unuintitive to have to call it directly. I modified to instance the variables when the module get included.
* | | | | | Bring config_accessor's API document back to its lifeAkira Matsuda2018-10-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | the document has been disappeared since the method became private at c2bfe6cbc8cab9caeab418472a1e12a3ed3e75e2
* | | | | | :warning: assigned but unused variable - loggerAkira Matsuda2018-10-031-1/+1
|/ / / / /
* | | | | Merge pull request #34051 from gmcgibbon/module_parent_method_renameRafael Mendonça França2018-10-024-26/+73
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | Prefix Module#parent, Module#parents, and Module#parent_name with module
| * | | | | Fix call sitesGannon McGibbon2018-10-021-2/+2
| | | | | |
| * | | | | Prefix Module#parent, Module#parents, and Module#parent_name with moduleGannon McGibbon2018-10-023-24/+71
| | | | | |
* | | | | | 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