aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/module/delegation.rb
Commit message (Collapse)AuthorAgeFilesLines
* Revert 88d08f2ec9f89ba431cba8d0c06ac9ebc204bbbbRafael Mendonça França2015-02-111-12/+24
| | | | | | | This caused a performance regression since we were decided to do the nil check in run time not in the load time. See https://github.com/rails/rails/pull/15187#issuecomment-71760058
* English fix [ci skip]George Millo2014-12-121-1/+1
|
* Delegation works with reserved words passed to `:to`Agis-2014-09-191-1/+9
| | | | Fixes #16956.
* Fix confusing exception in ActiveSupport delegationVladimir Yarotsky2014-05-201-25/+13
|
* define the delegate methods on one line. fixes #13724Aaron Patterson2014-01-161-20/+22
| | | | sup haters
* Revert "methods are defined right after the module_eval, so we don't need to do"Piotr Sarnacki2014-01-161-2/+2
| | | | | | | | | This change breaks tests in activesupport/test/core_ext/module_test.rb: * test_delegation_exception_backtrace * test_delegation_exception_backtrace_with_allow_nil This reverts commit 0167765e3f84260522bc2f32d926c1f5dd44957c.
* methods are defined right after the module_eval, so we don't need to doAaron Patterson2014-01-151-2/+2
| | | | any line number maths
* Improve Module#delegate documentation to tell that delegate don't work with ↵Lauro Caetano2013-11-291-0/+2
| | | | private or protected methods. [ci skip]
* Rely on NoMethodError#name when deciding to raise DelegationError.Federico Ravasio2013-08-121-2/+1
| | | | | | | | | | Different Ruby implementations present backtraces differently, as it should be an information consumed by humans. A better implementation should use data from the error, in this case returned by NoMethodError#name. Fixes issues with Rubinius, which presents backtraces differently from MRI.
* Merge branch 'master' of github.com:rails/docrailsVijay Dev2013-07-211-0/+5
|\
| * Enhancing readability of options for delegate methodThiago Pinto2013-07-161-0/+5
| |
* | Only raise DelegationError if it's is the source of the exceptionAndrew White2013-07-111-10/+11
|/ | | | | | | | | This fixes situations where nested NoMethodError exceptions are masked by delegations. This would cause confusion especially where there was a problem in the Rails booting process because of a delegation in the routes reloading code. Fixes #10559
* Move delegation error constant to inside ModuleCarlos Antonio da Silva2013-06-261-2/+4
|
* Merge pull request #10828 from southpolesteve/delegation_error_classYves Senn2013-06-261-1/+3
|\ | | | | Create DelegationError class
| * Add DelegationError class. Rasied by delegation to a nil objectSteve Faulkner2013-06-261-1/+3
| |
* | Fix some typosVipul A M2013-06-071-1/+1
|/
* Use new hash syntax in module delegation docs [ci skip]Carlos Antonio da Silva2013-04-281-1/+1
|
* Module#delegate checks nilness rather that falsehood if :allow_nil is true, ↵Xavier Noria2013-04-261-30/+42
| | | | | | | | | | | | | | 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.
* Delegation method bugLi Ellis Gallardo2013-04-251-0/+14
| | | | | | 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.
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-09-211-1/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: actionmailer/lib/action_mailer/base.rb activesupport/lib/active_support/configurable.rb activesupport/lib/active_support/core_ext/module/deprecation.rb guides/source/action_controller_overview.md guides/source/active_support_core_extensions.md guides/source/ajax_on_rails.textile guides/source/association_basics.textile guides/source/upgrading_ruby_on_rails.md While resolving conflicts, I have chosen to ignore changes done in docrails at some places - these will be most likely 1.9 hash syntax changes.
| * update some AS code examples to 1.9 hash syntax [ci skip]Francesco Rodriguez2012-09-121-10/+9
| |
* | Update delegate docs with new hash syntax [ci skip]Carlos Antonio da Silva2012-09-201-10/+10
| |
* | Add changelog entry and docs about class delegation using the symbol :classCarlos Antonio da Silva2012-09-201-0/+12
| | | | | | | | See #7613. [ci skip]
* | Nice and easy delegation to the classMarc-Andre Lafortune2012-09-111-0/+3
|/
* no need to to_s here. Both String and Symbol can be interpolated into StringAkira Matsuda2012-06-061-3/+0
|
* String quotes and trailing spacesAlexey Gaziev2012-04-291-8/+8
|
* AS core_ext refactoring pt.2Alexey Gaziev2012-04-291-1/+1
|
* Remove Module#delegate!Daniel Schierbeck2012-04-121-52/+0
|
* Add back the old `deprecate` method as `deprecate!`Daniel Schierbeck2012-04-121-0/+52
|
* Change API docs regarding delegation to non-public methodsDaniel Schierbeck2012-04-121-1/+1
|
* Optimize the performance of #delegateDaniel Schierbeck2012-04-121-9/+13
| | | | | | Remove the use of #__send__ in order to boost performance. This also means that you can no longer delegate to private methods on the target object.
* Remove deprecation from AS::Deprecation behavior, some minor cleanupsCarlos Antonio da Silva2012-03-161-7/+9
| | | | | | | | | * Refactor log subscriber, use select! to avoid a new object * Remove deprecation messages related to AS::Deprecation behavior This was added about 2 years ago for Rails 3: https://github.com/rails/rails/commit/d4c7d3fd94e5a885a6366eaeb3b908bb58ffd4db * Remove some not used requires * Refactor delegate to avoid string conversions and if statements inside each block
* Fix indentation in code example of DelegationTomasz Zurkowski2012-01-201-19/+19
|
* Revert all the stuff to do with disallowing non-public methods for ↵Jon Leighton2011-08-251-6/+2
| | | | Module#delegate
* prefer ends_with? over slicingXavier Noria2011-08-161-1/+2
|
* Add a test for delegating a method ending in '=' as this is a special case.Jon Leighton2011-08-151-0/+1
|
* Need to include public_sendArun Agrawal2011-08-151-0/+1
|
* Split up the definitions in Module#delegate depending on :allow_nil, and ↵Jon Leighton2011-08-151-17/+22
| | | | don't use exceptions for flow control in the :allow_nil => true case.
* Fix the line number in the backtrace when Module#delegate raisesJon Leighton2011-08-151-1/+1
|
* Just do the method call directly in Module#delegate, if we can (we cannot ↵Jon Leighton2011-08-151-1/+4
| | | | for method names ending in '='). Two reasons: 1) it's faster, see https://gist.github.com/1089783 and 2) more importantly, delegate should not allow you to accidentally call private or protected methods.
* Refactored to more closely resemble idiom applied for on_nilEvan Light2011-08-051-5/+11
|
* Remove unnecessary require (happened after fcbde454f6)Dmitriy Kiriyenko2011-08-011-2/+0
|
* Don't do remove_possible_method when delegate is used. Two reasons: 1) ↵Jon Leighton2011-07-181-4/+0
| | | | warnings should be shown, and fixed at the source and 2) the code is slow. Fixes #1937.
* Simplify boolean logic into ternary.Ben Orenstein2011-06-081-1/+1
|
* delegate method should treat :prefix => false same as :prefix => nilNeeraj Singh2010-09-011-1/+1
| | | | | | [#5375 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* fisting stack trace [#4349 state:resolved]Aaron Patterson2010-04-081-1/+1
| | | | Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Merge branch 'master' into docrailswycats2010-03-261-1/+7
|\
| * Singleton classes returns parent's methods with instance_methods(false) and ↵José Valim2010-03-191-1/+3
| | | | | | | | this makes remove_method in Module#delegate fail. Add a test case and fix the bug.
| * Eliminate warnings for AM on 1.8wycats2010-03-161-1/+5
| |
* | reformats an example in the rdoc of delegateXavier Noria2010-02-061-2/+7
| |