| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
'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
|
|\
| |
| |
| |
| | |
azimux/improve-hwia-initialize-by-skipping-to_h-if-already-a-hash
HashWithIndifferentAccess#initialize performance improvement
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* 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]
|
|\ \
| | |
| | | |
Refactor `ActiveSupport::Deprecation.deprecate_methods` not to expose internal methods
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | | |
|
| | | |
|
| | | |
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
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.
|
|\ \
| | |
| | |
| | |
| | | |
sushantmittal/add_deattach_from_in_active_support_subscriber
Adds 'detach_from' to 'ActiveSupport::Subscriber' to detach a subscriber from a namespace.
|
| | |
| | |
| | |
| | | |
from a namespace.
|
| | | |
|
|\ \ \
| | | |
| | | | |
sub, sub!, gsub, and gsub! should set back references
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Before:
```ruby
(1..10).cover?(1...11) => false
```
After:
```ruby
(1..10).cover?(1...11) => true
```
See https://git.io/fjTtz for the commit against Ruby core that added
support for Range arguments, with similar handling of this case.
|
| | | |
| | | |
| | | |
| | | | |
It allows anonymous subclasses to be garbage collected.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
* Update #instrument to make passing a block optional. This will let users
leverage #instrument for messaging in addition to instrumentation.
|
| |/ /
|/| |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
In #10634 the behavior of Time#advance was changed to maintain a
proleptic gregorian calendar for dates before calendar reform. However
it didn't full address dates a long time before calendar reform and
they gradually drift away from the proleptic calendar the further you
go back in time. Fix this by always converting the date to gregorian
before calling advance which sets the reform date to -infinity.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
When FileUpdateChecker is passed a directory and given an empty array of
extensions to match on, it will match any extension.
Previously, EventedFileUpdateChecker would never match any files when
given an empty array. This commit makes it EventedFileUpdateChecker
match FileUpdateChecker, and watch all extensions when given an empty
array.
|
| | | |
|
| | |
| | |
| | |
| | | |
Also add tests for parametrize and transliterate
|
| | | |
|
| | |
| | |
| | |
| | | |
Enumerable#excluding
|
| | |
| | |
| | |
| | | |
Related to 287920ca7d06c8f51198ec750d65ba703835b257
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Both methods were introduced in Ruby 2.5 and fit this use case very
nicely: listing a directory's entries excluding the "." and ".." nodes.
The private method #exclude_from was removed as it no longer serves
its original purpose.
|
|\ \ \
| | | |
| | | | |
use ProxyPattern to match for ActiveSupport::Notifications fanout/unsubscribe
|
| | | | |
|
| | | | |
|
| | | | |
|
|/ / / |
|
| | |
| | |
| | |
| | |
| | | |
If they're not set we'll still fall back to localhost, but this makes it
possible to run the tests against a remote Postgres / Redis / whatever.
|
|\ \ \
| | | |
| | | |
| | | | |
Support before_reset callback in CurrentAttributes
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This is useful when we need to do some work associated to `Current.reset`
but that work depends on the values of the current attributes themselves.
This cannot be done in the supported `resets` callback because when the
block is executed, CurrentAttributes's instance has already been reset.
For symmetry, `after_reset` is defined as alias of `resets`.
|
|/ / / |
|
| | | |
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
### Summary
There was an issues when using `safe_constantize` on a string that has
the wrong case.
File `em.rb` defines `EM`.
`"Em".safe_constantize` causes a little confusion with the autoloader.
The autoloader finds file "em.rb",
expecting it to define `Em`, but `Em` is not defined.
The autoloader raises a `LoadError`, which is good,
But `safe_constantize` is defined to return `nil` when a class is not found.
### Before
```
"Em".safe_constantize
LoadError: Unable to autoload constant Em, \
expected rails/activesupport/test/autoloading_fixtures/em.rb to define it
```
### After
```
"Em".safe_constantize
# => nil
```
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* Enable `Lint/UselessAssignment` cop to avoid unused variable warnings
Since we've addressed the warning "assigned but unused variable"
frequently.
370537de05092aeea552146b42042833212a1acc
3040446cece8e7a6d9e29219e636e13f180a1e03
5ed618e192e9788094bd92c51255dda1c4fd0eae
76ebafe594fc23abc3764acc7a3758ca473799e5
And also, I've found the unused args in c1b14ad which raises no warnings
by the cop, it shows the value of the cop.
|
|\ \ \
| | | |
| | | | |
Preserve key order of #fetch_multi
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
fetch_multi(*names) now returns its results in the same order
as the `*names` requested, rather than returning cache hits
followed by cache misses.
|
| | | | |
|
| | | |
| | | |
| | | | |
Accommodate case-insensitive filesystems and database collations.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Rails 6 requires Ruby 2.5, which introduces `FrozenError`
https://docs.ruby-lang.org/en/2.5.0/NEWS.html
Related to #31520
|
| | | |
| | | |
| | | |
| | | | |
See https://travis-ci.org/rails/rails/jobs/470890129#L2361
|