| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a block is passed into the method, it will be invoked for each
duplicated key, with the key in question and the two values as
arguments. The value for the duplicated key in the receiver will
be set to the return value of the block.
This behaviour matches Ruby's long-standing implementation of
Hash#update and is intended to provide a more consistent interface.
HashWithIndifferentAccess#merge is also affected by the change, as it
uses #update internally.
|
|
|
|
|
|
|
| |
Nowadays circular autoloads do not work, but the user gets a NameError
that says some constant is undefined. That's puzzling, because he is
normally trying to autoload a constant he knows can be autoloaded.
With this check we can give a better error message.
|
|\
| |
| | |
Refactored common date and time calculations.
|
| |
| |
| |
| |
| |
| |
| |
| | |
* Added the `DateAndTime::Calculations` module that is included in Time
and Date. It houses common calculations to reduce duplicated code.
* Simplified and cleaned-up the calculation code.
* Removed duplication in tests by adding a behavior module for shared
tests. I also added some missing tests.
|
| | |
|
| |
| |
| |
| |
| |
| | |
This reverts commit b0ab8dc0b2b0f580ffe5ac9ff57fd13152e18577
because it was removing the contents of the message when we
did not have any tag. A test case is also committed.
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
The revised test assumed that the default permissions of a file
matched the umask of the process, but in the general case that
depends also on the file system. This test was failing in the
/vagrant shared folder of Rails development boxes.
|
| |
| |
| |
| |
| |
| |
| | |
Previously, ActiveSupport::Autoload was global and reserved
for usage inside Rails. This pull request makes it local,
fixes its test (they were not being run because its file
was named wrongly) and make it part of Rails public API.
|
| | |
|
| |
| |
| |
| |
| |
| | |
ActiveSupport::Cache::MemCacheStore
memcache-client was deprecated in favour of dalli in 2010.
|
| |
| |
| |
| |
| |
| |
| | |
In cases where a notification subscriber includes methods to support
both Evented and Timed events, Evented should take priority over Timed.
This allows subscribers to be backwards compatible (older Rails only
allows Timed events) while defaulting to newer behavior.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Always merge I18n format values, namespaced or not, over the default
ones, to ensure I18n format defaults will have precedence over our
namespaced values.
Precedence should happen like this:
default :format
default :namespace :format
i18n :format
i18n :namespace :format
Because we cannot allow our namespaced default to override a I18n
:format config - ie precision in I18n :format should always have higher
precedence than our default precision for a particular :namespace.
Also simplify default format options logic.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Action Pack already comes with a default locale fine for :en, that is
always loaded. We can just fallback to this locale for defaults, if
values for the current locale cannot be found.
Closes #4420, #2802, #2890.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Reason: ActiveSupport::JSON::Variable is not used anymore internally. It
was deprecated in 3-2-stable but we reverted all the deprecation for
point releases.
See #6536 and #6546.
Conflicts:
activesupport/lib/active_support/json/variable.rb
|
| | |
|
|\ \
| | |
| | | |
Add AS::StringInquirer#respond_to? method
|
| |/
| |
| |
| | |
Consistently with #method_missing
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
by Active Support)
Selecting which key extensions to include in active_support/rails
made apparent the systematic usage of Object#in? in the code base.
After some discussion in
https://github.com/rails/rails/commit/5ea6b0df9a36d033f21b52049426257a4637028d
we decided to remove it and use plain Ruby, which seems enough
for this particular idiom.
In this commit the refactor has been made case by case. Sometimes
include? is the natural alternative, others a simple || is the
way you actually spell the condition in your head, others a case
statement seems more appropriate. I have chosen the one I liked
the most in each case.
|
|
|
|
|
| |
https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sheet#RULE_.231_-_HTML_Escape_Before_Inserting_Untrusted_Data_into_HTML_Element_Content
Closes #7215
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The Inflector is currently not very supportive of internationalized
websites. If a user wants to singularize and/or pluralize words based on
any locale other than English, they must define each case in locale
files. Rather than create large locale files with mappings between
singular and plural words, why not allow the Inflector to accept a
locale?
This patch makes ActiveSupport::Inflector locale aware and uses `:en`` unless
otherwise specified. Users will still be provided a list of English (:en)
inflections, but they may additionally define inflection rules for other
locales. Each list is kept separately and permanently. There is no reason to
limit users to one list of inflections:
ActiveSupport::Inflector.inflections(:es) do |inflect|
inflect.plural(/$/, 's')
inflect.plural(/([^aeéiou])$/i, '\1es')
inflect.plural(/([aeiou]s)$/i, '\1')
inflect.plural(/z$/i, 'ces')
inflect.plural(/á([sn])$/i, 'a\1es')
inflect.plural(/é([sn])$/i, 'e\1es')
inflect.plural(/í([sn])$/i, 'i\1es')
inflect.plural(/ó([sn])$/i, 'o\1es')
inflect.plural(/ú([sn])$/i, 'u\1es')
inflect.singular(/s$/, '')
inflect.singular(/es$/, '')
inflect.irregular('el', 'los')
end
'ley'.pluralize(:es) # => "leyes"
'ley'.pluralize(:en) # => "leys"
'avión'.pluralize(:es) # => "aviones"
'avión'.pluralize(:en) # => "avións"
A multilingual Inflector should be of use to anybody that is tasked with
internationalizing their Rails application.
Signed-off-by: David Celis <david@davidcelis.com>
|
|
|
|
|
|
| |
Ruby implementations should be free to produce exception
messages that are not identical to MRI. For example,
Rubinius produces 'Expected an even number, got 5'.
|
| |
|
|
|
|
| |
object does not implement the method
|
|
|
|
|
| |
This reverts commit c08f30ff5fcda7e07cd9275a073acb2091e4b3f7, reversing
changes made to e243a8a32eb4c8777f07ca4b974bd7e38d9477d3.
|
|
|
|
| |
When the default separator is set logger will create incorrect output
|
| |
|
|
|
|
|
| |
Mocha is already required by AS::TestCase, so remove the duplicate
requires.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Calculate the seconds since the UNIX epoch using the difference in
Julian day numbers from the epoch date. By reducing the Rational math
to just the offset component this gives a significant improvement.
Benchmark:
Calculating --------------------------------------------
new 27733 i/100ms
current 15031 i/100ms
new 27737 i/100ms
current 15549 i/100ms
--------------------------------------------------------
new 548182.1 (±0.9%) i/s - 2745567 in 5.008943s
current 216380.9 (±1.6%) i/s - 1082232 in 5.002781s
new 510281.9 (±1.2%) i/s - 2551804 in 5.001525s
current 219858.3 (±1.8%) i/s - 1103979 in 5.023039s
|
|
|
|
|
| |
Use Time.new to create times where the current offset is not zero or
not in the local time zone - closes #4847 and #6651.
|
|
|
|
|
|
|
|
| |
Introduced in 1abe31670fdad2c357b4356b40a4567a46d16693
The test was failing when running on isolation, because the extensions were
not being loaded, thus 1.year.from_now was failing. Just use mktime
instead, adding 1 year to Time.now.
|
| |
|
|
|
|
|
| |
Also simplify I18n logic for Array#to_sentence, doing only one lookup
for all keys and using merge!, instead of one lookup for each option key.
|
|
|
|
|
| |
Use a different and very specific locale for testing currency negative
format, and an empty store for currency defaults.
|
|
|
|
|
| |
They also make more sense here since all the related logic with I18n is
handled by AS::NumberHelper, and not by AV anymore.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a follow up to #4719. It appears that singularize and pluralize
are supposed to be idempotent - i.e. when you call singularize or
pluralize multiple times on the same string, you should get the same
result. (At least for the "officially supported" cases that the stock
inflector is designed to handle.) #4719 added the missing tests for
regular cases, and this commit added the missing tests for the
irregularities.
While I'm at that, I also synced up the irregularity test cases with
the current set of irregularity cases that we ship out-of-the-box.
|
| |
|
|
|
|
| |
Make the test description better reflect what is happening
|
| |
|
| |
|
|
|
|
|
|
| |
Ruby 2.0.0 implements LoadError#path, but newly raised load errors will
not contain the path information. Replace the error message, copy
blame, and rereaise the same exception object
|
| |
|
|
|
|
|
|
|
|
| |
This is an obsolete method from the very early days,
apparently it was used circa 2004 because STI support
was not smart enough. This method is not public
interface, and we are heading a major version, so
removal seems right.
|
|
|
|
|
|
| |
To facilitate the use of ActiveSupport::Testing::Performance outside
of a Rails application conditionally check for the presence of
Rails::VERSION::STRING before including it in the environment string.
|
|
|
|
|
|
|
|
|
|
| |
Changes:
* Add `instance_accessor` option to opt out of the instance writer and
instance reader methods.
* Raises a NameError if the name of the attribute is not valid.
* Update documentation and tests.
* Add CHANGELOG entry in activesupport.
|
|
|
|
| |
Eliminate the warnings generated by redefining methods and constants.
|
|\
| |
| | |
Remove deprecated ActiveSupport::JSON::Variable.
|
| | |
|
|\ \
| |/
|/|
| |
| | |
tjouan/tj/activesupport-fix-tests-requiring-unsafe-umask
Make tests pass with umask
|
| |
| |
| |
| |
| |
| | |
Assertions on file permissions only pass with some combinations of
file create mode and the process file mode creation mask. This mask
should be applied on the file create mode before related assertions.
|