Commit Graph

4723 Commits

Author SHA1 Message Date
Aaron Patterson
fe7f4b4bba using strings as scopes is not used anywhere, so remove it 2013-05-08 15:23:54 -07:00
Aaron Patterson
7d89a9f00a adding a class conditional test 2013-05-08 15:23:39 -07:00
Aaron Patterson
ece76f3840 adding tests for lambdas as conditions 2013-05-08 14:35:43 -07:00
Aaron Patterson
9e323e7dab separate identification computation 2013-05-08 13:36:04 -07:00
Aaron Patterson
8038f7eb10 separate filters from source code 2013-05-08 12:01:55 -07:00
Aaron Patterson
6abbc4a588 if the callbacks are not the same class, they cannot be duplicates 2013-05-08 11:37:33 -07:00
Aaron Patterson
f21da67aab fix object comparison case 2013-05-08 11:37:33 -07:00
Aaron Patterson
b9903c398e polymorphic comparison operator 2013-05-08 11:37:33 -07:00
Aaron Patterson
1ff1236b07 we need to indicate the type of callback 2013-05-08 11:37:26 -07:00
Jeremy Kemper
d77c64590a Merge pull request #10355 from burke/master
Use Ruby's native Encoding functionality to implement `tidy_bytes`
2013-05-08 11:09:17 -07:00
Aaron Patterson
5d2c3a14a3 adding more tests around callback inconsistencies 2013-05-08 10:31:02 -07:00
Aaron Patterson
d32b329b7e refactor tests for more points 2013-05-08 10:08:37 -07:00
Aaron Patterson
3df92d981b adding test to demonstrate inconsistencies in the AS::Callbacks api 2013-05-08 10:07:19 -07:00
Burke Libbey
738dbc0b39 Use ruby's Encoding support for tidy_bytes
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.
2013-05-08 11:55:02 -05:00
Tomohiko Himura
4de7442f45 dependency ActiveSupport::Deprecation 2013-05-09 00:41:00 +09:00
Prathamesh Sonpatki
b5429eec60 Fix Typo existant -> existent [ci skip] 2013-05-08 09:50:46 +05:30
Sean Walbran
2ed9ab2ed6 add changelog entry for fix-10502-skip-object-filter 2013-05-07 14:11:52 -05:00
Sean Walbran
9003a422f2 fix issue #10502, do not recompute method name for already-stringified object filter 2013-05-07 13:22:52 -05:00
Rafael Mendonça França
33283c98ed Merge pull request #10234 from dasch/dasch/fetch-multi
Allow fetching multiple values from the cache at once
2013-05-06 18:52:57 -07:00
Daniel Schierbeck
36d41a15c3 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.
2013-05-06 11:38:51 +02:00
Jeremy Kemper
b5e4eb24e0 Merge pull request #10453 from vipulnsward/destructive_sort
Speed up Hash#to_param by switching from #sort to #sort!
2013-05-05 14:48:34 -07:00
Vipul A M
41fbfb40d8 use destructive sort on array in Hash#to_param for performance gains.
Check https://gist.github.com/vipulnsward/6aad158c06a22f931a71 to see the gains.
2013-05-05 21:59:24 +05:30
Anton Kalyaev
13c19c8de0 use nokogirisax as a backend
Most likely someone just forgot to change it during copying and
pasting test cases from nokigiri engine test.
2013-05-05 19:47:50 +04:00
Ryan Davis
adc049b06f Fixed bad tests to clean up after themselves. 2013-05-03 15:37:18 -07:00
Aaron Patterson
4c242e6d33 Squashed commit of the following:
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.
2013-05-03 11:29:35 -07:00
Carlos Antonio da Silva
84139bad77 Merge pull request #10413 from vipulnsward/change_grouping
Use faster Array.new instead of []*padding
2013-05-03 05:06:40 -07:00
Jon Leighton
30f297bef5 Revert "Merge pull request #10433 from 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.
2013-05-03 12:45:02 +01:00
Jon Leighton
ffaceaa8cf Work around change in how MiniTest detects SIGINFO
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.
2013-05-03 11:59:52 +01:00
wangjohn
58151ce461 Improving the performance of callbacks by keeping a hash of the
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.
 ---------------------------------------------------------
2013-05-02 17:16:02 -04:00
Carlos Antonio da Silva
eee91eb77e Merge pull request #10412 from vipulnsward/fix_callback_test_typo
Fix typo in test
2013-05-02 05:55:26 -07:00
Tomohiko Himura
6f6c0b0ae2 Fixes Dependency bug in Active Support
DateTime defined in date.rb
2013-05-02 16:23:58 +09:00
Vipul A M
469befa7ef Fix typo in test 2013-05-02 09:42:57 +05:30
Vipul A M
6fa575bb4f Use faster Array.new instead of []*padding 2013-05-02 09:41:19 +05:30
Carlos Antonio da Silva
da47960893 Fix failures in AS with minitest 4.7.4 2013-05-01 23:21:08 -03:00
Brian Morearty
d7da403dde Revert "Object#in? also accepts multiple parameters"
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
2013-05-01 04:32:20 -07:00
Vijay Dev
7ead1d8143 Merge branch 'master' of github.com:lifo/docrails 2013-05-01 16:24:13 +05:30
Carlos Antonio da Silva
e8e2f010af Fix typos in deprecation proxy docs [ci skip] 2013-04-30 19:25:05 -03:00
Rafael Mendonça França
689370568f Merge pull request #10339 from eiel/unused-require
remove unused require
2013-04-30 12:00:13 -07:00
Rafael Mendonça França
feb44b9213 rails/master is now 4.1.0.beta 2013-04-29 13:15:24 -03:00
David Heinemeier Hansson
1ec64297f9 Bump version to rc1 2013-04-29 08:29:18 -07:00
Jeremy Kemper
226de24fa2 Merge pull request #10364 from wangjohn/refactoring_activesupport_cache
Making the retrieval of the cache store class a method
2013-04-28 11:15:36 -07:00
Carlos Antonio da Silva
85beb3f6bf Use new hash syntax in module delegation docs [ci skip] 2013-04-28 11:48:05 -03:00
wangjohn
3182295ce2 Making the retrieval of the cache store class a method, also wrote
comments for the expand_cache_key method.
2013-04-28 07:36:34 -04:00
Xavier Noria
65850baf98 Module#delegate checks nilness rather that falsehood if :allow_nil is true, 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.
2013-04-26 19:58:54 +02:00
Andrew White
051d289030 Merge pull request #9980 from stouset/patch-1
Improve poor security recommendation in docs

[ci skip]
2013-04-26 07:26:00 -07:00
Xavier Noria
11e23b9561 Merge pull request #10351 from JonRowe/update_as_date_next_week_to_document_intent
Propose better documentation for ActiveSupports `next_week` functionaility
2013-04-26 01:49:06 -07:00
Jon Rowe
e33dd308c9 formatting 2013-04-26 18:43:02 +10:00
Li Ellis Gallardo
ccbe023439 Delegation method bug
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.
2013-04-25 21:36:22 -05:00
Jon Rowe
888f21492a better document next_week functionaility closes #9568 2013-04-26 09:09:53 +10:00
Tomohiko Himura
d7d2f2bb15 remove unused require
not used remove_possible_method
2013-04-25 21:47:19 +09:00