Commit Graph

5189 Commits

Author SHA1 Message Date
Jeremy Kemper
e7b8769cbc Merge pull request #13321 from mezis/fix-safebuffer-interpolation-master
Fixes interpolation on SafeBuffer
2013-12-16 06:54:48 -08:00
Rafael Mendonça França
108171a44e Merge pull request #13307 from akshay-vishnoi/typo
Spelling and Grammar check [ci skip]
2013-12-15 11:19:44 -08:00
Akshay Vishnoi
c758093eca Spelling and Grammar check [ci skip] 2013-12-16 00:44:37 +05:30
Julien Letessier
a764938ad0 Fixes interpolation on SafeBuffer
Interpolation was untested and did not work with hash arguments.

Adds
- support for interpolation with hash argument
- tests for the above
- tests for safe/unsafe interpolation
2013-12-14 10:10:47 +00:00
Jeremy Kemper
b474d06d5e Perf: save ~9% of object allocations on heavy requests.
The per-thread registry is keyed on the class name, and each request for
the class name returns a new string. This is in the hot path for a lot
of Active Record behavior, so we easily accumulate thousands of repeated
strings.

To fix, we simply cache the key when the class is first extended with
the module.

TODO: Eliminate this module. The per-thread instance concept is common,
but this technique confuses and obfuscates.
2013-12-12 18:53:32 -07:00
Rafael Mendonça França
6e2b734f56 Merge pull request #13229 from vipulnsward/fix-10635-tests
Fix test-error introduced by #10635.
2013-12-12 08:52:40 -08:00
Vipul A M
1f80e8d685 PR #10635 introduces rescue from ArgumentError thrown by Base64.strict_decode64.
This broke natural order of things for `StaleSessionCheck#stale_session_check!` which tried auto_loading a class based on `ArgumentError` message , and later retrying the `Marshal#load` of class, successfully allowing auto_loading.

  This PR tries to fix this behavior by forwarding `ArgumentError` 's not raised  by `Base64.strict_decode64` , as is, ahead to `StaleSessionCheck#stale_session_check!`
2013-12-12 22:15:42 +05:30
Rafael Mendonça França
830044ee6f Copy-edit the parent commit 2013-12-12 14:09:04 -02:00
Rafael Mendonça França
415d1e10e3 Merge pull request #13268 from aayushkhandelwal11/master
Moving the common code of increment and decrement of cache file store in...
2013-12-12 14:04:21 -02:00
Aayush khandelwal
337a07b589 Moving the common code of increment and decrement of cache file store into seprate function
Removing the double checking for the value of id

simplifying code for checking conditional code for key

Removing the default values for parameters

removing reduntant code and asiigning value of id in local variable

removing wrongly added line break[ci ckip]

reverting code
2013-12-12 18:39:39 +05:30
Carlos Antonio da Silva
fe24f3560a Changelog improvements [ci skip] 2013-12-12 08:33:46 -02:00
Yves Senn
6f3c3ba784 Merge pull request #13287 from aayushkhandelwal11/typo_rectified
typos rectified lifecycle => life cycle
2013-12-11 23:32:04 -08:00
Aayush khandelwal
10fffd7ae6 typos rectified lifecycle => life cycle 2013-12-12 12:55:35 +05:30
Jeremy Kemper
864b92cd25 JSON: speed up date/time encoding
Comparing dates & times with other objects using #== is slow.
Internally, it hits #<=> which calls #to_datetime on objects
that don't respond to it, so we incur the cost of raising an
exception with a possibly-deep backtrace.

Cost of #jsonify on a Time object:

Calculating -------------------------------------
                 old      3644 i/100ms
                 new     12652 i/100ms
-------------------------------------------------
                 old    43373.8 (±3.5%) i/s -     218640 in   5.047017s
                 new   173437.6 (±5.2%) i/s -     872988 in   5.047747s
2013-12-11 23:32:33 -07:00
Godfrey Chan
ebfd97124d Merge pull request #13284 from aayushkhandelwal11/typos_corrected
s/everytime/every time/
2013-12-11 22:13:04 -08:00
Aayush khandelwal
4a9e54ef35 typos rectified [ci skip] 2013-12-12 11:29:23 +05:30
Carlos Antonio da Silva
59b7203180 Remove not necessary file, move constants to the file they are used
File 'empty_bool.rb' was introduced around 4 years ago in
c10958fbddb22052e7cbe5fe6b825cda3cb26e48 to remove method redefined
warning in AS test suite, however we do not have such need for reuse
anymore, so we can safely move the constants back to the file where
they are currently used and get rid of the extra file/require.
2013-12-11 20:40:04 -02:00
Carlos Antonio da Silva
443c31f8fc Nodoc missing number helper classes in AS [ci skip]
These classes are not meant to be public.
2013-12-11 20:01:54 -02:00
Aayush khandelwal
714a38217e typo rectified [skip ci] 2013-12-11 18:25:48 +05:30
Aaron Patterson
11c0ef58a6 Merge pull request #13260 from arunagw/using-parallelize_me
Using parallelize_me! to parallelize isolated test
2013-12-10 14:17:42 -08:00
Arun Agrawal
5743926d51 Using parallelize_me! to parallelize isolated test
As ParallelEach is no more available

related commit ec00442c10cb90796909e876fb1cc557ed7518bd
2013-12-10 22:09:58 +01:00
Elben Shira
88cff33a63 Replace with gsub! in ActiveSupport::Inflector. 2013-12-10 11:25:06 -06:00
Yves Senn
e74a9f9eea make collect_deprecations available.
There are circumstances where the capabilities of `assert_deprecated` and
`assert_not_deprecated` are not enough. For example if a ccertain call-path
raises two deprecations but should only raise a single one.

This module is still :nodoc and intented for internal use.

/cc @rafaelfranca
2013-12-10 15:22:31 +01:00
Yves Senn
900191fe2c doc: date/conversions.rb should talk about date format not time format.
Closes #13245.

[ci skip]
2013-12-10 11:09:31 +01:00
Godfrey Chan
849dbb5da8 Upgrade minitest version
We made a change in #13213 that depends on a new file that's only in
minitest 5.1.0+, so the version should be updated.
2013-12-08 07:35:19 -08:00
Aaron Patterson
12544f9422 Merge pull request #13213 from arunagw/aa-minitest-version-fix
Minitest upgrade broke build
2013-12-06 10:40:48 -08:00
Xavier Noria
01c9782fa2 better error message for constants autoloaded from anonymous modules [fixes #13204]
load_missing_constant is a private method that basically plays the role of const_missing.
This method has an error condition that is surprising: it raises if the class or module
already has the missing constant. How is it possible that if the class of module has
the constant Ruby has called const_missing in the first place?

The answer is that the from_mod argument is self except for anonymous modules, because
const_missing passes down Object in such case (see the comment in the source code of the
patch for the rationale).

But then, it is better to pass down Object *if Object is also missing the constant* and
otherwise err with an informative message right away.
2013-12-06 19:18:10 +01:00
Jeremy Kemper
8ef1ef1b82 Merge pull request #10635 from vipulnsward/change_to_strict
Use `Base.strict_decode64` instead of `Base.decode64`
2013-12-06 08:08:28 -08:00
Arun Agrawal
ec00442c10 Minitest upgrade broke build
34760e3b26

This PR should fix build
2013-12-06 16:53:14 +01:00
Mario Visic
ffe99774bb Fix issue with Kernel#silence_stream leaking file descriptors
Calling Kernel#silence_stream creates a new file descriptor which isn't
closed after it is used. As a result calling silence_stream multiple
times leads to a build up of loose file descriptors and can cause issues
in environments where garbage collection isn't run often.
2013-12-06 10:24:06 +11:00
Yves Senn
73b57a515f set i18n.enforce_available_locales before i18n.default_locale. 2013-12-05 13:19:51 +01:00
Carlos Antonio da Silva
556ad95b83 Review json_escape docs [ci skip] 2013-12-04 16:11:43 -02:00
Godfrey Chan
0696547814 Also move html_esacpe regex to a constant (see 9d25af60) 2013-12-04 09:46:38 -08:00
Godfrey Chan
2c564cdbdb Added \u2028 \u2029 to json_escape 2013-12-04 09:43:42 -08:00
Godfrey Chan
c229c7a39c Use lower case letters in unicodes sequences to match the new encoder's output 2013-12-04 09:27:55 -08:00
Godfrey Chan
2f1c5789c1 Fixed a long-standing bug in json_escape that strips quotation marks 2013-12-04 09:27:54 -08:00
Kuldeep Aggarwal
8195196e2a removed duplicate test case 2013-12-04 22:32:53 +05:30
Godfrey Chan
146e95c70d Backfilled CHANGELOG for AS::JSON::Variable removal (6f3e01e8) [ci skip] 2013-12-03 16:10:06 -08:00
Carlos Antonio da Silva
d5332de379 Remove earlier return in favor of conditional 2013-12-03 20:26:57 -02:00
Carlos Antonio da Silva
59ba94e8a2 Change delimiter check order: first check if it is present
This reads a lot better, and we won't need to try start_with? for blank
delimiters.

Also rename method name to read better.
2013-12-03 20:26:57 -02:00
Carlos Antonio da Silva
a63d8cd9e1 Make both conversion methods work similarly
The conversion without area code already changed the passed number in
place, so change the other method to do the same.
2013-12-03 20:26:56 -02:00
Carlos Antonio da Silva
308ed01f14 Remove useless empty string 2013-12-03 20:26:56 -02:00
Carlos Antonio da Silva
da507b71f6 No need for #tap 2013-12-03 20:26:56 -02:00
Carlos Antonio da Silva
55afd62f23 Avoid a hash creation since defaults is a new hash already 2013-12-03 20:26:56 -02:00
Carlos Antonio da Silva
e56a553c95 Stop using local variables everywhere, make use of the reader 2013-12-03 20:26:56 -02:00
Carlos Antonio da Silva
4e19ef9b25 Refactor to avoid earlier returns 2013-12-03 20:26:56 -02:00
Carlos Antonio da Silva
72db343334 Rename variable that holds whether or not the class should validate a float number 2013-12-03 20:26:56 -02:00
Carlos Antonio da Silva
7c20a8b558 Changelog improvements [ci skip] 2013-12-03 14:38:12 -02:00
Dimko
18546d4e35 Added Date#all_week/month/quarter/year for generating date ranges 2013-12-03 20:32:20 +04:00
Colin Bartlett
029f24ede9 Add support for localized date references
Ruby's Date class automatically gives us #yesterday, #today,
and #tomorrow. And ActiveSupport has a handy Time.zone.today
for getting a localized version. But there was no localized
version of #yesterday or #tomorrow. Until now.
2013-12-03 10:37:01 -05:00