2017-02-07 10:13:15 -05:00
|
|
|
* Remove deprecated behavior that halts callbacks when the return is false.
|
|
|
|
|
|
|
|
*Rafael Mendonça França*
|
|
|
|
|
2017-01-18 18:50:35 -05:00
|
|
|
* Deprecate passing string to `:if` and `:unless` conditional options
|
|
|
|
on `set_callback` and `skip_callback`.
|
|
|
|
|
|
|
|
*Ryuta Kamizono*
|
|
|
|
|
2017-01-08 05:45:58 -05:00
|
|
|
* Raise `ArgumentError` when passing string to define callback.
|
|
|
|
|
|
|
|
*Ryuta Kamizono*
|
|
|
|
|
2017-01-26 04:15:37 -05:00
|
|
|
* Updated Unicode version to 9.0.0
|
|
|
|
|
|
|
|
Now we can handle new emojis such like "👩👩👧👦" ("\u{1F469}\u{200D}\u{1F469}\u{200D}\u{1F467}\u{200D}\u{1F466}").
|
|
|
|
|
|
|
|
version 8.0.0
|
|
|
|
|
|
|
|
"👩👩👧👦".mb_chars.grapheme_length # => 4
|
|
|
|
"👩👩👧👦".mb_chars.reverse # => "👦👧👩👩"
|
|
|
|
|
|
|
|
version 9.0.0
|
|
|
|
|
|
|
|
"👩👩👧👦".mb_chars.grapheme_length # => 1
|
|
|
|
"👩👩👧👦".mb_chars.reverse # => "👩👩👧👦"
|
|
|
|
|
|
|
|
*Fumiaki MATSUSHIMA*
|
|
|
|
|
2017-01-16 13:52:57 -05:00
|
|
|
* Changed `ActiveSupport::Inflector#transliterate` to raise `ArgumentError` when it receives
|
|
|
|
anything except a string.
|
|
|
|
|
|
|
|
*Kevin McPhillips*
|
|
|
|
|
2017-01-14 13:36:27 -05:00
|
|
|
* Fixed bugs that `StringInquirer#respond_to_missing?` and
|
|
|
|
`ArrayInquirer#respond_to_missing?` do not fallback to `super`.
|
2017-01-14 12:38:21 -05:00
|
|
|
|
|
|
|
*Akira Matsuda*
|
|
|
|
|
2017-01-08 17:43:49 -05:00
|
|
|
* Fix inconsistent results when parsing large durations and constructing durations from code
|
|
|
|
|
|
|
|
ActiveSupport::Duration.parse('P3Y') == 3.years # It should be true
|
|
|
|
|
|
|
|
Duration parsing made independent from any moment of time:
|
|
|
|
Fixed length in seconds is assigned to each duration part during parsing.
|
|
|
|
|
|
|
|
Changed duration of months and years in seconds to more accurate and logical:
|
|
|
|
|
|
|
|
1. The value of 365.2425 days in Gregorian year is more accurate
|
|
|
|
as it accounts for every 400th non-leap year.
|
|
|
|
|
|
|
|
2. Month's length is bound to year's duration, which makes
|
|
|
|
sensible comparisons like `12.months == 1.year` to be `true`
|
|
|
|
and nonsensical ones like `30.days == 1.month` to be `false`.
|
|
|
|
|
|
|
|
Calculations on times and dates with durations shouldn't be affected as
|
|
|
|
duration's numeric value isn't used in calculations, only parts are used.
|
|
|
|
|
|
|
|
Methods on `Numeric` like `2.days` now use these predefined durations
|
|
|
|
to avoid duplicating of duration constants through the codebase and
|
|
|
|
eliminate creation of intermediate durations.
|
|
|
|
|
|
|
|
*Andrey Novikov, Andrew White*
|
|
|
|
|
2016-12-21 11:41:36 -05:00
|
|
|
* Change return value of `Rational#duplicable?`, `ComplexClass#duplicable?`
|
|
|
|
to false.
|
|
|
|
|
|
|
|
*utilum*
|
|
|
|
|
2016-12-06 19:24:50 -05:00
|
|
|
* Change return value of `NilClass#duplicable?`, `FalseClass#duplicable?`,
|
|
|
|
`TrueClass#duplicable?`, `Symbol#duplicable?` and `Numeric#duplicable?`
|
|
|
|
to true with Ruby 2.4+. These classes can dup with Ruby 2.4+.
|
|
|
|
|
|
|
|
*Yuji Yaginuma*
|
|
|
|
|
2017-01-08 05:45:58 -05:00
|
|
|
* Remove deprecated class `ActiveSupport::Concurrency::Latch`.
|
2016-11-14 07:44:19 -05:00
|
|
|
|
|
|
|
*Andrew White*
|
|
|
|
|
2017-01-08 05:45:58 -05:00
|
|
|
* Remove deprecated separator argument from `parameterize`.
|
2016-11-14 07:14:23 -05:00
|
|
|
|
|
|
|
*Andrew White*
|
|
|
|
|
2017-01-08 05:45:58 -05:00
|
|
|
* Remove deprecated method `Numeric#to_formatted_s`.
|
2016-11-14 07:03:48 -05:00
|
|
|
|
|
|
|
*Andrew White*
|
|
|
|
|
2017-01-08 05:45:58 -05:00
|
|
|
* Remove deprecated method `alias_method_chain`.
|
2016-11-14 06:57:30 -05:00
|
|
|
|
|
|
|
*Andrew White*
|
|
|
|
|
2017-01-08 05:45:58 -05:00
|
|
|
* Remove deprecated constant `MissingSourceFile`.
|
2016-11-14 06:25:52 -05:00
|
|
|
|
|
|
|
*Andrew White*
|
|
|
|
|
2016-11-14 03:11:21 -05:00
|
|
|
* Remove deprecated methods `Module.qualified_const_defined?`,
|
2017-01-08 05:45:58 -05:00
|
|
|
`Module.qualified_const_get` and `Module.qualified_const_set`.
|
2016-11-14 03:11:21 -05:00
|
|
|
|
|
|
|
*Andrew White*
|
|
|
|
|
2017-01-08 05:45:58 -05:00
|
|
|
* Remove deprecated `:prefix` option from `number_to_human_size`.
|
2016-11-13 18:25:05 -05:00
|
|
|
|
|
|
|
*Andrew White*
|
|
|
|
|
2017-01-08 05:45:58 -05:00
|
|
|
* Remove deprecated method `ActiveSupport::HashWithIndifferentAccess.new_from_hash_copying_default`.
|
2016-11-13 18:25:05 -05:00
|
|
|
|
|
|
|
*Andrew White*
|
|
|
|
|
2017-01-08 05:45:58 -05:00
|
|
|
* Remove deprecated file `active_support/core_ext/time/marshal.rb`.
|
2016-11-13 18:25:05 -05:00
|
|
|
|
|
|
|
*Andrew White*
|
|
|
|
|
2017-01-08 05:45:58 -05:00
|
|
|
* Remove deprecated file `active_support/core_ext/struct.rb`.
|
2016-11-13 18:25:05 -05:00
|
|
|
|
|
|
|
*Andrew White*
|
|
|
|
|
2017-01-08 05:45:58 -05:00
|
|
|
* Remove deprecated file `active_support/core_ext/module/method_transplanting.rb`.
|
2016-11-13 18:25:05 -05:00
|
|
|
|
|
|
|
*Andrew White*
|
|
|
|
|
2017-01-08 05:45:58 -05:00
|
|
|
* Remove deprecated method `Module.local_constants`.
|
2016-11-13 18:25:05 -05:00
|
|
|
|
|
|
|
*Andrew White*
|
|
|
|
|
2017-01-08 05:45:58 -05:00
|
|
|
* Remove deprecated file `active_support/core_ext/kernel/debugger.rb`.
|
2016-11-13 18:25:05 -05:00
|
|
|
|
|
|
|
*Andrew White*
|
|
|
|
|
2017-01-08 05:45:58 -05:00
|
|
|
* Remove deprecated method `ActiveSupport::Cache::Store#namespaced_key`.
|
2016-11-13 18:25:05 -05:00
|
|
|
|
|
|
|
*Andrew White*
|
|
|
|
|
2017-01-08 05:45:58 -05:00
|
|
|
* Remove deprecated method `ActiveSupport::Cache::Strategy::LocalCache::LocalStore#set_cache_value`.
|
2016-11-13 18:25:05 -05:00
|
|
|
|
|
|
|
*Andrew White*
|
|
|
|
|
2017-01-08 05:45:58 -05:00
|
|
|
* Remove deprecated method `ActiveSupport::Cache::MemCacheStore#escape_key`.
|
2016-11-13 18:25:05 -05:00
|
|
|
|
|
|
|
*Andrew White*
|
|
|
|
|
2017-01-08 05:45:58 -05:00
|
|
|
* Remove deprecated method `ActiveSupport::Cache::FileStore#key_file_path`.
|
2016-11-13 18:25:05 -05:00
|
|
|
|
|
|
|
*Andrew White*
|
|
|
|
|
2017-01-08 05:45:58 -05:00
|
|
|
* Ensure duration parsing is consistent across DST changes.
|
2016-10-31 13:21:15 -04:00
|
|
|
|
|
|
|
Previously `ActiveSupport::Duration.parse` used `Time.current` and
|
|
|
|
`Time#advance` to calculate the number of seconds in the duration
|
|
|
|
from an arbitrary collection of parts. However as `advance` tries to
|
|
|
|
be consistent across DST boundaries this meant that either the
|
|
|
|
duration was shorter or longer depending on the time of year.
|
|
|
|
|
|
|
|
This was fixed by using an absolute reference point in UTC which
|
|
|
|
isn't subject to DST transitions. An arbitrary date of Jan 1st, 2000
|
|
|
|
was chosen for no other reason that it seemed appropriate.
|
|
|
|
|
|
|
|
Additionally, duration parsing should now be marginally faster as we
|
|
|
|
are no longer creating instances of `ActiveSupport::TimeWithZone`
|
|
|
|
every time we parse a duration string.
|
|
|
|
|
|
|
|
Fixes #26941.
|
|
|
|
|
|
|
|
*Andrew White*
|
|
|
|
|
2016-10-23 10:33:40 -04:00
|
|
|
* Use `Hash#compact` and `Hash#compact!` from Ruby 2.4. Old Ruby versions
|
|
|
|
will continue to get these methods from Active Support as before.
|
|
|
|
|
|
|
|
*Prathamesh Sonpatki*
|
|
|
|
|
2016-10-20 08:44:22 -04:00
|
|
|
* Fix `ActiveSupport::TimeZone#strptime`.
|
|
|
|
Support for timestamps in format of seconds (%s) and milliseconds (%Q).
|
|
|
|
|
|
|
|
Fixes #26840.
|
|
|
|
|
|
|
|
*Lev Denisov*
|
|
|
|
|
2016-10-19 12:43:57 -04:00
|
|
|
* Fix `DateAndTime::Calculations#copy_time_to`. Copy `nsec` instead of `usec`.
|
|
|
|
|
|
|
|
Jumping forward or backward between weeks now preserves nanosecond digits.
|
|
|
|
|
|
|
|
*Josua Schmid*
|
|
|
|
|
2016-09-23 08:03:48 -04:00
|
|
|
* Fix `ActiveSupport::TimeWithZone#in` across DST boundaries.
|
|
|
|
|
|
|
|
Previously calls to `in` were being sent to the non-DST aware
|
|
|
|
method `Time#since` via `method_missing`. It is now aliased to
|
|
|
|
the DST aware `ActiveSupport::TimeWithZone#+` which handles
|
|
|
|
transitions across DST boundaries, e.g:
|
|
|
|
|
|
|
|
Time.zone = "US/Eastern"
|
|
|
|
|
|
|
|
t = Time.zone.local(2016,11,6,1)
|
2016-10-23 10:33:40 -04:00
|
|
|
# => Sun, 06 Nov 2016 01:00:00 EDT -05:00
|
2016-09-23 08:03:48 -04:00
|
|
|
|
|
|
|
t.in(1.hour)
|
2016-10-23 10:33:40 -04:00
|
|
|
# => Sun, 06 Nov 2016 01:00:00 EST -05:00
|
2016-09-23 08:03:48 -04:00
|
|
|
|
|
|
|
Fixes #26580.
|
|
|
|
|
|
|
|
*Thomas Balthazar*
|
|
|
|
|
2016-07-02 08:46:52 -04:00
|
|
|
* Remove unused parameter `options = nil` for `#clear` of
|
|
|
|
`ActiveSupport::Cache::Strategy::LocalCache::LocalStore` and
|
|
|
|
`ActiveSupport::Cache::Strategy::LocalCache`.
|
|
|
|
|
|
|
|
*Yosuke Kabuto*
|
|
|
|
|
2016-08-08 06:35:29 -04:00
|
|
|
* Fix `thread_mattr_accessor` subclass no longer overwrites parent.
|
2016-07-04 05:17:20 -04:00
|
|
|
|
2016-08-08 06:35:29 -04:00
|
|
|
Assigning a value to a subclass using `thread_mattr_accessor` no
|
|
|
|
longer changes the value of the parent class. This brings the
|
|
|
|
behavior inline with the documentation.
|
|
|
|
|
|
|
|
Given:
|
|
|
|
|
|
|
|
class Account
|
|
|
|
thread_mattr_accessor :user
|
|
|
|
end
|
|
|
|
|
|
|
|
class Customer < Account
|
|
|
|
end
|
|
|
|
|
|
|
|
Account.user = "DHH"
|
|
|
|
Customer.user = "Rafael"
|
|
|
|
|
|
|
|
Before:
|
|
|
|
|
|
|
|
Account.user # => "Rafael"
|
|
|
|
|
|
|
|
After:
|
|
|
|
|
|
|
|
Account.user # => "DHH"
|
2016-07-04 05:17:20 -04:00
|
|
|
|
|
|
|
*Shinichi Maeshima*
|
|
|
|
|
2016-08-03 09:45:09 -04:00
|
|
|
* Since weeks are no longer converted to days, add `:weeks` to the list of
|
|
|
|
parts that `ActiveSupport::TimeWithZone` will recognize as possibly being
|
|
|
|
of variable duration to take account of DST transitions.
|
|
|
|
|
|
|
|
Fixes #26039.
|
|
|
|
|
|
|
|
*Andrew White*
|
|
|
|
|
2016-07-21 17:41:03 -04:00
|
|
|
* Defines `Regexp.match?` for Ruby versions prior to 2.4. The predicate
|
2016-07-21 18:27:39 -04:00
|
|
|
has the same interface, but it does not have the performance boost. Its
|
2016-07-21 17:41:03 -04:00
|
|
|
purpose is to be able to write 2.4 compatible code.
|
|
|
|
|
|
|
|
*Xavier Noria*
|
|
|
|
|
2016-08-10 00:02:22 -04:00
|
|
|
* Allow `MessageEncryptor` to take advantage of authenticated encryption modes.
|
2016-07-18 07:48:58 -04:00
|
|
|
|
|
|
|
AEAD modes like `aes-256-gcm` provide both confidentiality and data
|
2016-08-10 00:02:22 -04:00
|
|
|
authenticity, eliminating the need to use `MessageVerifier` to check if the
|
2016-07-18 07:48:58 -04:00
|
|
|
encrypted data has been tampered with. This speeds up encryption/decryption
|
|
|
|
and results in shorter cipher text.
|
|
|
|
|
|
|
|
*Bart de Water*
|
|
|
|
|
2016-06-13 16:28:05 -04:00
|
|
|
* Introduce `assert_changes` and `assert_no_changes`.
|
|
|
|
|
|
|
|
`assert_changes` is a more general `assert_difference` that works with any
|
|
|
|
value.
|
|
|
|
|
|
|
|
assert_changes 'Error.current', from: nil, to: 'ERR' do
|
|
|
|
expected_bad_operation
|
|
|
|
end
|
|
|
|
|
|
|
|
Can be called with strings, to be evaluated in the binding (context) of
|
|
|
|
the block given to the assertion, or a lambda.
|
|
|
|
|
|
|
|
assert_changes -> { Error.current }, from: nil, to: 'ERR' do
|
|
|
|
expected_bad_operation
|
|
|
|
end
|
|
|
|
|
|
|
|
The `from` and `to` arguments are compared with the case operator (`===`).
|
|
|
|
|
|
|
|
assert_changes 'Error.current', from: nil, to: Error do
|
|
|
|
expected_bad_operation
|
|
|
|
end
|
|
|
|
|
|
|
|
This is pretty useful, if you need to loosely compare a value. For example,
|
|
|
|
you need to test a token has been generated and it has that many random
|
|
|
|
characters.
|
|
|
|
|
|
|
|
user = User.start_registration
|
|
|
|
assert_changes 'user.token', to: /\w{32}/ do
|
|
|
|
user.finish_registration
|
|
|
|
end
|
|
|
|
|
|
|
|
*Genadi Samokovarov*
|
|
|
|
|
2016-07-11 23:48:56 -04:00
|
|
|
* Fix `ActiveSupport::TimeZone#strptime`. Now raises `ArgumentError` when the
|
|
|
|
given time doesn't match the format. The error is the same as the one given
|
|
|
|
by Ruby's `Date.strptime`. Previously it raised
|
|
|
|
`NoMethodError: undefined method empty? for nil:NilClass.` due to a bug.
|
|
|
|
|
|
|
|
Fixes #25701.
|
|
|
|
|
|
|
|
*John Gesimondo*
|
|
|
|
|
2016-07-21 17:41:03 -04:00
|
|
|
* `travel/travel_to` travel time helpers, now raise on nested calls,
|
2016-05-06 12:39:32 -04:00
|
|
|
as this can lead to confusing time stubbing.
|
2016-06-13 16:28:05 -04:00
|
|
|
|
2016-05-06 12:39:32 -04:00
|
|
|
Instead of:
|
2016-06-13 16:28:05 -04:00
|
|
|
|
2016-05-06 12:39:32 -04:00
|
|
|
travel_to 2.days.from_now do
|
|
|
|
# 2 days from today
|
|
|
|
travel_to 3.days.from_now do
|
|
|
|
# 5 days from today
|
2016-06-13 16:28:05 -04:00
|
|
|
end
|
2016-05-06 12:39:32 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
preferred way to achieve above is:
|
|
|
|
|
2016-07-21 17:41:03 -04:00
|
|
|
travel 2.days do
|
2016-05-06 12:39:32 -04:00
|
|
|
# 2 days from today
|
|
|
|
end
|
2016-06-13 16:28:05 -04:00
|
|
|
|
|
|
|
travel 5.days do
|
|
|
|
# 5 days from today
|
|
|
|
end
|
|
|
|
|
2016-05-06 12:39:32 -04:00
|
|
|
*Vipul A M*
|
|
|
|
|
2016-06-27 11:36:49 -04:00
|
|
|
* Support parsing JSON time in ISO8601 local time strings in
|
|
|
|
`ActiveSupport::JSON.decode` when `parse_json_times` is enabled.
|
|
|
|
Strings in the format of `YYYY-MM-DD hh:mm:ss` (without a `Z` at
|
|
|
|
the end) will be parsed in the local timezone (`Time.zone`). In
|
|
|
|
addition, date strings (`YYYY-MM-DD`) are now parsed into `Date`
|
|
|
|
objects.
|
2015-11-14 12:04:28 -05:00
|
|
|
|
|
|
|
*Grzegorz Witek*
|
|
|
|
|
2016-06-22 20:42:54 -04:00
|
|
|
* Fixed `ActiveSupport::Logger.broadcast` so that calls to `#silence` now
|
|
|
|
properly delegate to all loggers. Silencing now properly suppresses logging
|
|
|
|
to both the log and the console.
|
|
|
|
|
|
|
|
*Kevin McPhillips*
|
|
|
|
|
2016-06-13 12:05:33 -04:00
|
|
|
* Remove deprecated arguments in `assert_nothing_raised`.
|
|
|
|
|
|
|
|
*Rafel Mendonça França*
|
|
|
|
|
2016-06-02 11:44:20 -04:00
|
|
|
* `Date.to_s` doesn't produce too many spaces. For example, `to_s(:short)`
|
|
|
|
will now produce `01 Feb` instead of ` 1 Feb`.
|
|
|
|
|
|
|
|
Fixes #25251.
|
|
|
|
|
|
|
|
*Sean Griffin*
|
|
|
|
|
2016-08-10 00:02:22 -04:00
|
|
|
* Introduce `Module#delegate_missing_to`.
|
2016-02-27 12:23:42 -05:00
|
|
|
|
|
|
|
When building a decorator, a common pattern emerges:
|
|
|
|
|
|
|
|
class Partition
|
|
|
|
def initialize(first_event)
|
|
|
|
@events = [ first_event ]
|
|
|
|
end
|
|
|
|
|
|
|
|
def people
|
|
|
|
if @events.first.detail.people.any?
|
|
|
|
@events.collect { |e| Array(e.detail.people) }.flatten.uniq
|
|
|
|
else
|
|
|
|
@events.collect(&:creator).uniq
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
def respond_to_missing?(name, include_private = false)
|
|
|
|
@events.respond_to?(name, include_private)
|
|
|
|
end
|
|
|
|
|
|
|
|
def method_missing(method, *args, &block)
|
|
|
|
@events.send(method, *args, &block)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
With `Module#delegate_missing_to`, the above is condensed to:
|
|
|
|
|
|
|
|
class Partition
|
|
|
|
delegate_missing_to :@events
|
|
|
|
|
|
|
|
def initialize(first_event)
|
|
|
|
@events = [ first_event ]
|
|
|
|
end
|
|
|
|
|
|
|
|
def people
|
|
|
|
if @events.first.detail.people.any?
|
|
|
|
@events.collect { |e| Array(e.detail.people) }.flatten.uniq
|
|
|
|
else
|
|
|
|
@events.collect(&:creator).uniq
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
*Genadi Samokovarov*, *DHH*
|
|
|
|
|
2016-05-13 20:43:48 -04:00
|
|
|
* Rescuable: If a handler doesn't match the exception, check for handlers
|
|
|
|
matching the exception's cause.
|
|
|
|
|
|
|
|
*Jeremy Daer*
|
2016-05-06 17:54:40 -04:00
|
|
|
|
2016-05-10 00:07:09 -04:00
|
|
|
Please check [5-0-stable](https://github.com/rails/rails/blob/5-0-stable/activesupport/CHANGELOG.md) for previous changes.
|