| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| | |
Fix rubocop space before comma
|
|/ |
|
|\
| |
| | |
Add support for multiple encodings in String.blank?
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Motivation:
- When strings are encoded with `.encode("UTF-16LE")` `.blank?` throws
an `Encoding::CompatibilityError` exception.
- We tested multiple implementation to see what the fastest
implementation was, rescueing the execption seems to be the fastest
option we could find.
Related Issues:
- #28953
Changes:
- Add a rescue to catch the exception.
- Added a `Concurrent::Map` to store a cache of encoded regex objects
for requested encoding types.
- Use the new `Concurrent::Map` cache to return the correct regex for
the string being checked.
|
|\ \
| | |
| | | |
Duration created with no parts will have a default seconds part eqaul to 0
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This pull request handles `FrozenError` introduced by Ruby 2.5.
Refer https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/61131
Since `FrozenError` is a subclass of `RuntimeError` minitest used by master
branch can handle it, though it would be better to handle `FrozenError`
explicitly if possible.
`FrozenError` does not exist in Ruby 2.4 or lower, `frozen_error_class`
handles which exception is expected to be raised.
This pull request is intended to be merged to master,
then backported to `5-1-stable` to address #31508
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
`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.
|
| | |
| | |
| | |
| | | |
Follow up of #31432.
|
| | |
| | |
| | |
| | | |
Follow up of #31390.
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
These methods were originally added in https://github.com/rails/rails/pull/26600
This includes a couple of refactors to make these methods behave more similarly to other Date/Time extensions added by Active Support:
1. Use `advance` instead of `since` and `ago` to time-travel — this is particularly important to keep the returned instance’s class matching `self`. Before this change:
today = Date.today # => Tue, 28 Nov 2017
today.class # => Date
today.next_occurring(:wednesday) # => Wed, 29 Nov 2017 00:00:00 UTC +00:00
today.next_occurring(:wednesday).class # => ActiveSupport::TimeWithZone
After this change, a Date (or Time, or DateTime) instance is properly returned (just like is shown in the new docs). This is generally how everything else in DateAndTime::Calculations works.
2. Move the tests from the DateTime tests to the DateAndTimeBehavior tests. The latter location is mixed in to the core_ext tests for _all_ of Date, Time, and DateTime to test the behavior across all of the classes. The previous location is for testing core_ext functionality added specifically just to DateTime.
3. Better docs!
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Make `ActiveSupport::TimeWithZone` match Ruby's handling of ambiguous
times by choosing the later period, e.g.
Ruby:
```
ENV["TZ"] = "Europe/Moscow"
Time.local(2014, 10, 26, 1, 0, 0) # => 2014-10-26 01:00:00 +0300
```
Before:
```
>> "2014-10-26 01:00:00".in_time_zone("Moscow")
TZInfo::AmbiguousTime: 26/10/2014 01:00 is an ambiguous local time.
```
After:
```
>> "2014-10-26 01:00:00".in_time_zone("Moscow")
=> Sun, 26 Oct 2014 01:00:00 MSK +03:00
```
Fixes #17395.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
## Summary
RuboCop 0.51.0 was released.
https://github.com/bbatsov/rubocop/releases/tag/v0.51.0
And rubocop-0-51 channel is available in Code Climate.
https://github.com/codeclimate/codeclimate-rubocop/issues/109
This PR will bump RuboCop to 0.51.0 and fixes the following new
offenses.
```console
% bundle exec rubocop
Inspecting 2358 files
(snip)
Offenses:
actionpack/lib/action_controller/metal/http_authentication.rb:251:59: C:
Prefer double-quoted strings unless you need single quotes to avoid
extra backslashes for escaping.
[key.strip, value.to_s.gsub(/^"|"$/, "").delete('\'')]
^^^^
activesupport/test/core_ext/load_error_test.rb:8:39: C: Prefer
double-quoted strings unless you need single quotes to avoid extra
backslashes for escaping.
assert_raise(LoadError) { require 'no_this_file_don\'t_exist' }
^^^^^^^^^^^^^^^^^^^^^^^^^^^
2358 files inspected, 2 offenses detected
```
|
|\ \
| | |
| | | |
Fixed typo in test for activesupport parameterize
|
| |/ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In #11474 we prevented TWZ ranges being iterated over which matched
Ruby's handling of Time ranges and as a consequence `include?` stopped
working with both Time ranges and TWZ ranges. However in
ruby/ruby@b061634 support was added for `include?` to use `cover?` for
'linear' objects. Since we have no way of making Ruby consider TWZ
instances as 'linear' we have to override `Range#include?`.
Fixes #30799.
|
|\ \
| |/
|/|
| |
| | |
bogdanvlviv/method_signature_prev-next-day-month-year_for_time
Mirror the API of Ruby stdlib for #prev_day, #next_day, #prev_month, #next_month, #prev_year, #next_year
|
| | |
|
| | |
|
| | |
|
|/ |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add test for the new exception of delegate_missing_to
* Add a changelog entry
* Only check for nil if NoMethodError was raised
* Make method private
* Have to pass both target name and value
* Inline the re-raise
[Rafael Mendonça França + Anton Khamets]
|
|
|
|
|
|
|
|
|
| |
String#camelize was returning nil without any feedback when an
invalid option was passed as parameter. This update makes the method
to raises an ArgumentError when the option passed is invalid, similar
to what Ruby does for String#downcase (and others) in 2.4.1.
https://ruby-doc.org/core-2.4.1/String.html#method-i-downcase
|
|
|
|
|
|
|
|
|
|
|
| |
Rails 5.1 introduce an `ActiveSupport::Duration::Scalar` class as
a wrapper around a numeric value as a way of ensuring a duration
was the outcome of an expression. However the implementation was
missing support for modulo operations. This commit adds support
for those operations and should result in a duration being
returned from expressions involving them.
Fixes #29603 and #29743.
|
|
|
|
|
|
|
|
|
| |
PR #29163 introduced a change in behavior when a duration was
the denominator in a calculation - this was incorrect as dividing
by a duration should always return a `Numeric`. The behavior of
previous versions of Rails has been restored.
Fixes #29592.
|
|\ |
|
| | |
|
| |\
| | |
| | | |
Use frozen-string-literal in ActiveSupport
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
```
/Users/kamipo/src/github.com/rails/rails/activesupport/test/core_ext/module_test.rb:402: warning: `*' interpreted as argument prefix
/Users/kamipo/src/github.com/rails/rails/activesupport/test/core_ext/module_test.rb:420: warning: `*' interpreted as argument prefix
```
|
| |\ \
| | |/
| |/|
| | | |
Return prefixed method names from `Module.delegate`, if using prefixes
|
| |/
| |
| |
| | |
if using prefix version.
|
| | |
|
| |
| |
| |
| |
| | |
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
|
| |\
| | |
| | |
| | | |
Enforce frozen string in Rubocop
|
| | | |
|
| |\ \
| | |/
| |/|
| | | |
Make ActiveSupport frozen-string-literal friendly.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| |/ |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* Allow a default value to be declared for class_attribute
* Convert to using class_attribute default rather than explicit setter
* Removed instance_accessor option by mistake
* False is a valid default value
* Documentation
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Previously calculations where the scalar is first would be converted
to a duration of seconds but this causes issues with dates being
converted to times, e.g:
Time.zone = "Beijing" # => Asia/Shanghai
date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
2 * 1.day # => 172800 seconds
date + 2 * 1.day # => Mon, 22 May 2017 00:00:00 CST +08:00
Now the `ActiveSupport::Duration::Scalar` calculation methods will try
to maintain the part structure of the duration where possible, e.g:
Time.zone = "Beijing" # => Asia/Shanghai
date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
2 * 1.day # => 2 days
date + 2 * 1.day # => Mon, 22 May 2017
Fixes #29160, #28970.
|
| |
| |
| | |
The method is named `delegate_missing_to`, not `delegate_to_missing`
|
| |
| |
| |
| |
| |
| |
| |
| | |
The Enumerator#size method was introduced in Ruby 2.0.
These tests were added when Rails 4.1 was current, and Ruby 1.9.3 was
still supported. Since Rails 5 only Ruby >= 2.2.2 is supported, so the
checks are no longer necessary.
|
| |
| |
| |
| |
| |
| |
| | |
Support `:offset` in `Time#change` and `:zone` or `:offset`
in `ActiveSupport::TimeWithZone#change`.
Fixes #28723.
|
| | |
|