aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
Commit message (Collapse)AuthorAgeFilesLines
* Correct human file size examples [ci skip]Alexander Graul2019-05-201-1/+1
| | | | | | | | | | The `number_to_human_size` helpers in Action View and Active Support calculate the "human size" with a base of 1024. The examples should reflect that so they don't confuse the reader. The updated documentations use the values from: helper.number_to_human_size(1500)
* Introduce ↵Vishal Telangre2019-05-102-7/+53
| | | | | | | | | | | | | | | | | | | | 'ActiveSupport::Notifications::Fanout::Subscribers::MonotonicTimed' and 'ActiveSupport::Notifications::monotonic_subscribe' Also, change the signature of ‘ActiveSupport::Notifications::Fanout#subscribe’ to accept optional ‘monotonic’ boolean argument. Then initialize either a ‘Timed’ or ‘MonotonicTimed’ subscriber based on the value of ‘monotonic’ parameter. Introduce ‘ActiveSupport::Notifications::monotonic_subscribe’ method Also, provision ‘ActiveSupport::Notifications::subscribed’ to optionally accept ‘monotonic’ boolean argument. Update documentation for ActiveSupport::Notifications Add tests Update guides documentation under the 'Active Support Instrumentation' chapter Incorporate feedback: use optional keyword argument to specify optional 'monotonic' option to 'subscribed' method Fix a typo
* Merge pull request #34642 from ↵Rafael França2019-05-011-1/+1
|\ | | | | | | | | azimux/improve-hwia-initialize-by-skipping-to_h-if-already-a-hash HashWithIndifferentAccess#initialize performance improvement
| * HashWithIndifferentAccess#initialize performance improvementMiles Georgi2018-12-061-1/+1
| | | | | | | | | | | | | | | | | | Rails 4 -> Rails 5 introduced a #to_hash call in HashWithIndifferentAccess#initialize to guarantee access to the #default and #default_proc methods. This can be a very expensive operation for very large HashWithIndifferentAccess objects. This commit bypasses this #to_hash call if it is already a Hash.
* | revert changes to monotonic timesKevin Solorio2019-04-301-2/+2
| | | | | | | | | | | | | | | | | | | | The change to monotonic times causes failures for applications where the subscribed block is expecting Time objects as described in this issue: https://github.com/rails/rails/issues/36145 The original PR (https://github.com/rails/rails/pull/35984) was concerned with errors on the cpu_time. Test was edited to reflect changes to initializer using 0 values instead of nil
* | Improve error message of ActiveSupport delegateokuramasafumi2019-04-291-1/+1
| | | | | | | | | | | | | | | | | | ActiveSupport `delegate` has `to` option, but it's not a option hash anymore and now it's a keyword argument. When `to` argument is not given, it raises an ArgumentError but the message suggests supplying "options hash", which is now wrong. Now it's fixed to provide correct suggestion to supply a keyword argument.
* | Frozen truncate (#36109)Jordan Thomas2019-04-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add test asserting truncate returns unfrozen string * Ensure strings returned from truncate are not frozen This fixes an issue where strings too short to be truncated were returned unfrozen, where as long-enough strings were returned frozen. Now retuned strings will not be frozen whether or not the string returned was shortened. * Update changelog w/ new truncate behavior description [Jordan Thomas + Rafael Mendonça França]
* | Start Rails 6.1 developmentRafael Mendonça França2019-04-242-3/+3
| |
* | upgrades Zeitwerk to 2.1.4Xavier Noria2019-04-232-11/+9
| | | | | | | | | | | | This commit more or less undoes 9b5401f, restores autoloaded? not to touch the descendants tracker, and autoloaded_constants because it is documented in the guide.
* | Merge pull request #36037 from kamipo/deprecate_methodsRyuta Kamizono2019-04-191-18/+7
|\ \ | | | | | | Refactor `ActiveSupport::Deprecation.deprecate_methods` not to expose internal methods
| * | Refactor `ActiveSupport::Deprecation.deprecate_methods` not to expose ↵Ryuta Kamizono2019-04-191-18/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | internal methods In #33325, `deprecate_methods` is replaced from `prepend` to completely emurated `alias_method_chain`, it exposed two internal methods `xxx_with_deprecation` and `xxx_without_deprecation`. After that, #34648 restored the `prepend` implementation, which doesn't expose any internal methods, so we no longer be able to ensure to always expose that internal methods. As I said at https://github.com/rails/rails/pull/33325#issuecomment-409016725, I think that internal methods exposed is not a specification but a limitation when using `alias_method_chain`, there is no longer a reason to follow that limitation.
* | | Refactor after the most recent code reviewGenadi Samokovarov2019-04-191-10/+6
| | |
* | | Tweak the ActionableError docs a bitGenadi Samokovarov2019-04-191-4/+2
| | |
* | | Simplify the ActionableError.{dispatch,action} boundriesGenadi Samokovarov2019-04-191-11/+7
| | |
* | | Drop the ambiguous `ActiveSupport::ActionableError#===` checkGenadi Samokovarov2019-04-191-9/+14
| | |
* | | Introduce Actionable ErrorsGenadi Samokovarov2019-04-191-0/+53
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Actionable errors let's you dispatch actions from Rails' error pages. This can help you save time if you have a clear action for the resolution of common development errors. The de-facto example are pending migrations. Every time pending migrations are found, a middleware raises an error. With actionable errors, you can run the migrations right from the error page. Other examples include Rails plugins that need to run a rake task to setup themselves. They can now raise actionable errors to run the setup straight from the error pages. Here is how to define an actionable error: ```ruby class PendingMigrationError < MigrationError #:nodoc: include ActiveSupport::ActionableError action "Run pending migrations" do ActiveRecord::Tasks::DatabaseTasks.migrate end end ``` To make an error actionable, include the `ActiveSupport::ActionableError` module and invoke the `action` class macro to define the action. An action needs a name and a procedure to execute. The name is shown as the name of a button on the error pages. Once clicked, it will invoke the given procedure.
* | Document redis: Object optionSteven Harman2019-04-181-5/+7
| | | | | | | | | | | | | | There are four ways to pass the redis option, but only three were documented. This is now consistent with implementation. [ci skip]
* | Merge pull request #36012 from r7kamura/feature/safe-buffer-multiplicationRyuta Kamizono2019-04-191-0/+6
|\ \ | | | | | | Preserve html_safe? status on ActiveSupport::SafeBuffer#*
| * | Preserve html_safe? status on ActiveSupport::SafeBuffer#*r7kamura2019-04-191-0/+6
| | |
* | | If exception occurs during setup, add to each test executedAric Walker2019-04-181-1/+10
|/ / | | | | | | | | | | Resolves https://github.com/rails/rails/issues/35835 If an exception occurs during `parallelize_setup` make sure to catch that exception and apply it to the result of each successive test run. This results in marking all of the tests as failed to bring attention to the issue & ensure it is addressed before proceeding.
* | Merge pull request #35052 from schuetzm/silence-i18n-fallback-deprecationKasper Timm Hansen2019-04-171-1/+2
|\ \ | | | | | | Describe how to silence the deprecation warning about empty I18n fall…
| * | Describe how to silence the deprecation warning about empty I18n fallbacksMarc Schütz2019-01-251-1/+2
| | |
* | | Merge pull request #35886 from okuramasafumi/add-docs-to-concernRyuta Kamizono2019-04-171-1/+24
|\ \ \ | | | | | | | | Add documentations to concern methods [ci skip]
| * | | Add documentations to AS::Concern#included and #class_methodsokuramasafumi2019-04-171-0/+23
| | | |
| * | | Add `:nodoc` to ActiveSupport::Concern#append_featuresokuramasafumi2019-04-161-1/+1
| | | |
* | | | Removed unused require for active_support/deprecationPrathamesh Sonpatki2019-04-171-1/+0
| | | | | | | | | | | | | | | | - Unused since https://github.com/rails/rails/commit/a91ea1d51048342d13f
* | | | Merge pull request #35984 from vishaltelangre/asn-misc-fixesJeremy Daer2019-04-162-6/+5
|\ \ \ \ | | | | | | | | | | Various fixes in ActiveSupport::Notifications::Event
| * | | | Remove @duration instance variable since we're not maintaining instances ↵Vishal Telangre2019-04-161-2/+1
| | | | | | | | | | | | | | | | | | | | variables such as @cpu_time, @idle_time and @allocations; this reduces one allocation
| * | | | Use monotonic time to record `started` and `finished` time values for an ↵Vishal Telangre2019-04-161-2/+2
| | | | | | | | | | | | | | | | | | | | event subscribed by a `ActiveSupport::Notifications::Fanout::Subscribers::Timed` subscriber
| * | | | Fix: #cpu_time doesn't work for a ↵Vishal Telangre2019-04-161-2/+2
| | | | | | | | | | | | | | | | | | | | `ActiveSupport::Notifications::Fanout::Subscribers::Timed` subscriber
* | | | | running test with_info_handler methodMauri Mustonen2019-04-161-1/+3
| | | | |
* | | | | Find query_source_location using lazy EnumeratorJohn Hawthorn2019-04-151-1/+5
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This way, we only need to filter the backtrace up to the first non-noise stack frame. This also updates noise to be able to deal with being passed a lazy enum. We don't need this anywhere, but it seemed better for this to be consistent.
* | | | Redis fetch without names returns {}David Verhasselt2019-04-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When trying to call mget in Redis without any parameters, a Redis error is thrown. To avoid this, we circumvent Redis entirely when there are no key names given.
* | | | Auto-correct `Style/RedundantBegin` cop offencesRyuta Kamizono2019-04-121-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is newly added at 7b6b10542d5dac2b50f2578143dc5d70120d1146. ``` % be rubocop -a Inspecting 2781 files ...............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. Offenses: activesupport/lib/active_support/dependencies/zeitwerk_integration.rb:12:1: C: [Corrected] Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body beginning. activesupport/lib/active_support/dependencies/zeitwerk_integration.rb:12:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. activesupport/lib/active_support/dependencies/zeitwerk_integration.rb:12:13: C: [Corrected] Style/RedundantBegin: Redundant begin block detected. begin ^^^^^ activesupport/lib/active_support/dependencies/zeitwerk_integration.rb:13:11: C: [Corrected] Layout/IndentationWidth: Use 2 (not 4) spaces for indentation. Rails.autoloaders.main.reload ^^^^ activesupport/lib/active_support/dependencies/zeitwerk_integration.rb:16:1: C: [Corrected] Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body end. activesupport/lib/active_support/dependencies/zeitwerk_integration.rb:16:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. 2781 files inspected, 6 offenses detected, 6 offenses corrected ```
* | | | improves the reloading disabled error messageXavier Noria2019-04-111-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original message from Zeitwerk is "can't reload, please call loader.enable_reloading before setup (Zeitwerk::Error)", which is not very informative for Rails programmers. Rails should err with a message worded in terms of its interface.
* | | | depend on Zeitwerk 2.1.0Xavier Noria2019-04-092-13/+11
| | | |
* | | | depend on Zeitwerk 2Xavier Noria2019-04-071-3/+4
|/ / /
* | | Merge pull request #35691 from ↵Rafael França2019-04-041-6/+55
|\ \ \ | | | | | | | | | | | | | | | | sushantmittal/add_deattach_from_in_active_support_subscriber Adds 'detach_from' to 'ActiveSupport::Subscriber' to detach a subscriber from a namespace.
| * | | Added 'detach_from' to 'ActiveSupport::Subscriber' to detach a subscriber ↵sushant2019-04-041-6/+55
| | | | | | | | | | | | | | | | from a namespace.
* | | | Merge pull request #35771 from timoschilling/hash-speed-improvementsRafael França2019-04-022-4/+7
|\ \ \ \ | | | | | | | | | | Hash / HashWithIndifferentAccess speed improvements
| * | | | Speed improvement for HashWithIndifferentAccess#values_atTimo Schilling2019-04-021-2/+2
| | | | |
| * | | | Speed improvement for HashWithIndifferentAccess#fetch_valuesTimo Schilling2019-04-021-1/+1
| | | | |
| * | | | Speed improvement for HashWithIndifferentAccess#exceptTimo Schilling2019-04-011-0/+3
| | | | |
| * | | | Speed improvement for Hash#exceptTimo Schilling2019-03-291-1/+1
| | | | |
* | | | | Tweaks CHANGELOGs and docs [ci skip]Ryuta Kamizono2019-03-311-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add leading `#` before `=>` since hash rocket is valid Ruby code * add backticks * remove trailing spaces * and more
* | | | | fixes eager loading edge case in :zeitwerk modeXavier Noria2019-03-302-7/+18
|/ / / /
* | | | Merge pull request #34405 from shugo/safe_buffer_backref_fixMatthew Draper2019-03-281-2/+37
|\ \ \ \ | | | | | | | | | | sub, sub!, gsub, and gsub! should set back references
| * | | | Eliminate a thread local variable as suggested by nobuShugo Maeda2019-02-141-8/+1
| | | | |
| * | | | Remove trailing spaceShugo Maeda2018-11-081-1/+1
| | | | |
| * | | | Add a commented code example of what will be producedShugo Maeda2018-11-081-22/+22
| | | | |