| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Since Ruby 2.0 is UTF-8 by default we need to explictly say that the
encoding of this file is US-ASCII
|
|\ \ \ \ \ \
| |_|_|/ / /
|/| | | | |
| | | | | | |
Escape multibyte line terminators in JSON encoding
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Currently, json/encoding respects the JSON spec (as it should) which
disallows \n and \r inside strings, escaping them as expected.
Unfortunately, ECMA-262 (Javascript) disallows not only \n and \r in
strings, but "Line Terminators" which includes U+2028 and U+2029.
See here: http://bclary.com/2004/11/07/#a-7.3
This pull request adds U+2028 and U+2029 to be escaped.
# Why?
It's very common to see something like this in a Rails template:
<script type="text/javascript">
var posts = <%= @posts.to_json %>;
</script>
If U+2028 or U+2029 are part of any attributes output in the to_json
call, you will end up with an exception.
In Chrome: Uncaught SyntaxError: Unexpected token ILLEGAL
# Why not?
This is JSON encoding, and the JSON spec is specific about how to
encode strings. U+2028 and U+2029 don't get special treatment.
Just trying to start a discussion... what do you do in your apps
to deal with this? Is there a convention I'm missing?
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Require different core extensions correctly.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
The begin rescue block is specifically to catch LoadError while loading
i18n gem. Other core extensions, under active support, should be
required outside of the begin rescue block.
|
|/ / / / / / |
|
| | | | | | |
|
| | | | | | |
|
| |/ / / /
|/| | | | |
|
| | | | | |
|
| | | | | |
|
| | | | | |
|
| | | | | |
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The previous implementation was quite slow. This leverages some of the
transcoding abilities built into Ruby 1.9 instead. It is roughly 96%
faster.
The roundtrip through UTF_8_MAC here is because ruby won't let you
transcode from UTF_8 to UTF_8. I chose the closest encoding I could
find as an intermediate.
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | | |
object filter
|
|\ \ \ \ \
| |_|_|_|/
|/| | | | |
Allow fetching multiple values from the cache at once
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Add a simple API for fetching a list of entries from the cache, where
any missing entries are computed by a supplied block.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Speed up Hash#to_param by switching from #sort to #sort!
|
| |/ / / /
| | | | |
| | | | |
| | | | | |
Check https://gist.github.com/vipulnsward/6aad158c06a22f931a71 to see the gains.
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
commit 2683de5da85135e8d9fe48593ff6167db9d64b18
Author: Aaron Patterson <aaron.patterson@gmail.com>
Date: Fri May 3 11:29:20 2013 -0700
cannot support infinite ranges right now
commit cebb6acef2c3957f975f6db4afd849e535126253
Author: Aaron Patterson <aaron.patterson@gmail.com>
Date: Fri May 3 11:26:12 2013 -0700
reverting infinity comparison
commit 385f7e6b4efd1bf9b89e8d607fcb13e5b03737ea
Author: Aaron Patterson <aaron.patterson@gmail.com>
Date: Fri May 3 11:23:28 2013 -0700
Revert "Added ability to compare date/time with infinity"
This reverts commit 38f28dca3aa16efd6cc3af6453f2e6b9e9655ec1.
Conflicts:
activesupport/CHANGELOG.md
activesupport/lib/active_support/core_ext/numeric/infinite_comparable.rb
activesupport/test/core_ext/date_ext_test.rb
activesupport/test/core_ext/date_time_ext_test.rb
activesupport/test/core_ext/numeric_ext_test.rb
activesupport/test/core_ext/time_ext_test.rb
activesupport/test/core_ext/time_with_zone_test.rb
commit 0d799a188dc12b18267fc8421675729917610047
Author: Aaron Patterson <aaron.patterson@gmail.com>
Date: Fri May 3 11:18:53 2013 -0700
Revert "Refactor infinite comparable definition a bit"
This reverts commit dd3360e05e4909f2f0c74a624cccc2def688f828.
commit 42dec90e49745bbfae546f0560b8783f6b48b074
Author: Aaron Patterson <aaron.patterson@gmail.com>
Date: Fri May 3 11:18:47 2013 -0700
Revert "Require 'active_support/core_ext/module/aliasing' in the infinite_comparable module"
This reverts commit 7003e71c13c53ec3d34250560fbf80b8381df693.
|
|\ \ \ \
| | | | |
| | | | | |
Use faster Array.new instead of []*padding
|
| | |/ /
| |/| | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
wangjohn/making_callbacks_more_performant"
This reverts commit 09751fdc847c25237891a8fcb0c2312e39bbe86d, reversing
changes made to 6a5ab08d21c4284a05f5e34484b18a91d4e5c50c.
This change caused a failure in
actionpack/test/abstract/callbacks_test.rb.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
MiniTest 4.7.3 detects the presence of SIGINFO and stores the answer in
a constant.
It seems that MiniTest 4.7.4 changes this, and instead relies on an
info_signal method being implemented on the runner object.
In ActiveSupport::Testing::Isolation, we use ProxyTestResult to stand in
for the runner object. This object implements `method_missing`, and as
such its #info_signal method has a truthy return value. This results in
MiniTest trying to install the SIGINFO handler on platforms where
SIGINFO does not exists.
To fix, I am simply defining an explicit ProxyTestResult#info_signal
method.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
callbacks in the CallbackChain, so you don't have to iterate over all
callbacks when checking for duplicates.
Benchmark results when the tests in
activerecord/test/cases/associations_test.rb were run with and without
the change:
== On master (when scanning all of the callbacks):
---------------------------------------------------------
% cumulative self self total
time seconds seconds calls ms/call ms/call name
---------------------------------------------------------
1.85 9.26 0.82 18412 0.04 0.05
ActiveSupport::Callbacks::Callback#matches?
1.22 12.32 0.54 18412 0.03 0.08
ActiveSupport::Callbacks::Callback#duplicates?
0.93 14.61 0.41 19600 0.02 0.21
ActiveSupport::Callbacks::CallbackChain#remove_duplicates
Finished tests in 1.217065s, 30.4010 tests/s, 53.4072 assertions/s.
---------------------------------------------------------
== On my branch (when using a hash to check callback duplication):
---------------------------------------------------------
% cumulative self self total
time seconds seconds calls ms/call ms/call name
---------------------------------------------------------
0.15 29.63 0.06 1188 0.05 0.72
ActiveSupport::Callbacks::CallbackChain#handle_duplicates
0.00 40.50 0.00 84 0.00 0.12
ActiveSupport::Callbacks::Callback#matches?
0.00 40.50 0.00 84 0.00 0.12
ActiveSupport::Callbacks::Callback#duplicates?
0.00 40.50 0.00 91 0.00 0.22
ActiveSupport::Callbacks::CallbackChain#scan_and_remove_duplicates
Finished tests in 1.117757s, 33.1020 tests/s, 58.1522 assertions/s.
---------------------------------------------------------
|
| | | |
| | | |
| | | |
| | | | |
DateTime defined in date.rb
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This reverts commit ebf69ab1636df74c76332c53bcd3d8494fb91b45.
`in?` must not take multiple parameters because its behavior would be
ambiguous:
# Test if "B" is included in a list of names with `"B".in?(*names)`:
names = ["BMorearty"]
"B".in?(*names) # => true
names = ["BMorearty","rubyduo"]
"B".in?(*names) # => false
Conflicts:
activesupport/lib/active_support/core_ext/object/inclusion.rb
activesupport/test/core_ext/object/inclusion_test.rb
|
|\ \ \ |
|
| | | | |
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
remove unused require
|
| | | | |
| | | | |
| | | | |
| | | | | |
not used remove_possible_method
|
| | | | | |
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Making the retrieval of the cache store class a method
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
comments for the expand_cache_key method.
|
|/ / / / / |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
and avoids multiple evaluation of the target method
Notes:
1) I hope nilness is a word.
2) See rationale for avoiding multiple evaluation in a comment in the patch, credit goes to @jeremy for pointing out this gotcha in the existing implementation.
3) Embeds a little joke dedicated to @pixeltrix (it could be worse! :D).
References #10347.
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Improve poor security recommendation in docs
[ci skip]
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
As reported in #9960, the current documentation recommends an insecure practice for
key generation from a password (a single round of SHA-256). The modified documentation
uses ActiveSupport::KeyGenerator to perform proper key stretching.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
JonRowe/update_as_date_next_week_to_document_intent
Propose better documentation for ActiveSupports `next_week` functionaility
|
| | | | | | | |
|
| | |/ / / /
| |/| | | | |
|
|/ / / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Add documentation and test to delegation method that make sure we're
aware that when a delegated object is not nil or false and doesn't
respond to the method it will still raise a NoMethodError exception.
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
refactor initialization of array
|
| | | | | | |
|
|/ / / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The changes in b79adc4323 had a bug where if the time in the String
was in standard time but the current time was in daylight savings then
the calculated adjustment was off by an hour.
This commit fixes this and adds extra tests for the following:
* time in string is standard time, current time is standard time
* time in string is standard time, current time is daylight savings
* time in string is daylight savings, current time is standard time
* time in string is daylight savings, current time is daylight savings
Fixes #10306.
|