Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Add separate test to ensure that `delegate` with `:private` option returns ↵ | bogdanvlviv | 2018-02-28 | 1 | -6/+16 |
| | | | | | | | | correct value Remove extra comments `# Asking for private method` in activesupport/test/core_ext/module_test.rb Improve docs of using `delegate` with `:private` Update changelog of #31944 | ||||
* | add private: true option for ActiveSupport delegate | Tomas Valent | 2018-02-26 | 1 | -0/+57 |
| | |||||
* | Use assert_predicate and assert_not_predicate | Daniel Colson | 2018-01-25 | 1 | -1/+1 |
| | |||||
* | Use respond_to test helpers | Daniel Colson | 2018-01-25 | 1 | -9/+9 |
| | |||||
* | Test for the new exception of delegate_missing_to (#30191) | Anton Khamets | 2017-08-12 | 1 | -0/+8 |
| | | | | | | | | | | | | | | | * Add test for the new exception of delegate_missing_to * Add a changelog entry * Only check for nil if NoMethodError was raised * Make method private * Have to pass both target name and value * Inline the re-raise [Rafael Mendonça França + Anton Khamets] | ||||
* | [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` | Koichi ITO | 2017-07-11 | 1 | -0/+1 |
| | |||||
* | Merge pull request #29728 from kirs/frozen-activesupport | Matthew Draper | 2017-07-09 | 1 | -0/+1 |
|\ | | | | | Use frozen-string-literal in ActiveSupport | ||||
| * | Use frozen-string-literal in ActiveSupport | Kir Shatrov | 2017-07-09 | 1 | -0/+1 |
| | | |||||
* | | Fix warning: `*' interpreted as argument prefix | Ryuta Kamizono | 2017-07-06 | 1 | -2/+2 |
| | | | | | | | | | | | | | | ``` /Users/kamipo/src/github.com/rails/rails/activesupport/test/core_ext/module_test.rb:402: warning: `*' interpreted as argument prefix /Users/kamipo/src/github.com/rails/rails/activesupport/test/core_ext/module_test.rb:420: warning: `*' interpreted as argument prefix ``` | ||||
* | | Merge pull request #29687 from k3rni/private-prefixed-delegate | Matthew Draper | 2017-07-06 | 1 | -0/+38 |
|\ \ | |/ |/| | | | Return prefixed method names from `Module.delegate`, if using prefixes | ||||
| * | Use `map` in `delegate` so that actual prefixed method names are returned, ↵ | Krzysztof Zych | 2017-07-05 | 1 | -0/+39 |
|/ | | | | if using prefix version. | ||||
* | Revert "Merge pull request #29540 from kirs/rubocop-frozen-string" | Matthew Draper | 2017-07-02 | 1 | -1/+0 |
| | | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa. | ||||
* | Enforce frozen string in Rubocop | Kir Shatrov | 2017-07-01 | 1 | -0/+1 |
| | |||||
* | Update test names to match method name | T.J. Schuck | 2017-05-04 | 1 | -6/+6 |
| | | | The method is named `delegate_missing_to`, not `delegate_to_missing` | ||||
* | delegate_missing_to should fall back to super | Matthew Draper | 2017-04-09 | 1 | -0/+22 |
| | |||||
* | delegate_to_missing doesn't delegate private methods | Matthew Draper | 2017-04-09 | 1 | -0/+10 |
| | | | | So we shouldn't claim they're there, even when asked explicitly. | ||||
* | Adjust `Module.parent_name` to work when frozen; fixes #27637 | Corey Ward | 2017-01-17 | 1 | -30/+0 |
| | |||||
* | Constant look-up would no longer fall back to top-level constant since ruby 2.5 | Akira Matsuda | 2017-01-13 | 1 | -2/+2 |
| | | | | | See: https://github.com/ruby/ruby/commit/44a2576f798b07139adde2d279e48fdbe71a0148 https://github.com/ruby/ruby/commit/9df88e9cae57aa421230f14500e88f33f127414f | ||||
* | class Foo < Struct.new(:x) creates an extra unneeded anonymous class | Akira Matsuda | 2017-01-13 | 1 | -1/+1 |
| | | | | because Struct.new returns a Class, we just can give it a name and use it directly without inheriting from it | ||||
* | assert_equal takes expectation first | Akira Matsuda | 2016-12-26 | 1 | -9/+9 |
| | |||||
* | Remove deprecated method alias_method_chain | Andrew White | 2016-11-14 | 1 | -215/+0 |
| | |||||
* | Remove deprecated local_constants | Andrew White | 2016-11-13 | 1 | -10/+0 |
| | |||||
* | Add more rubocop rules about whitespaces | Rafael Mendonça França | 2016-10-29 | 1 | -2/+2 |
| | |||||
* | Add three new rubocop rules | Rafael Mendonça França | 2016-08-16 | 1 | -3/+3 |
| | | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository. | ||||
* | Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty lines | Ryuta Kamizono | 2016-08-07 | 1 | -1/+0 |
| | |||||
* | normalizes indentation and whitespace across the project | Xavier Noria | 2016-08-06 | 1 | -3/+3 |
| | |||||
* | modernizes hash syntax in activesupport | Xavier Noria | 2016-08-06 | 1 | -25/+25 |
| | |||||
* | applies new string literal convention in activesupport/test | Xavier Noria | 2016-08-06 | 1 | -35/+35 |
| | | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default. | ||||
* | Add test for `delegate_missing_to` where method doesn't exist | Jon Moss | 2016-05-26 | 1 | -0/+8 |
| | |||||
* | Add tests for keyword arg to: for Module#delegate | Yosuke Kabuto | 2016-05-25 | 1 | -0/+15 |
| | |||||
* | Don't delegate to private methods of the targer | Rafael Mendonça França | 2016-05-24 | 1 | -0/+14 |
| | | | | And make sure that it doesn't even try to call the method in the target. | ||||
* | Merge pull request #23930 from gsamokovarov/module-delegate-missing-to | Rafael Mendonça França | 2016-05-24 | 1 | -0/+22 |
|\ | | | | | | | Introduce Module#delegate_missing_to | ||||
| * | Introduce Module#delegate_missing_to | Genadi Samokovarov | 2016-02-27 | 1 | -0/+22 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When building decorators, a common pattern may emerge: class Partition def initialize(first_event) @events = [ first_event ] end def people if @events.first.detail.people.any? @events.collect { |e| Array(e.detail.people) }.flatten.uniq else @events.collect(&:creator).uniq end end private def respond_to_missing?(name, include_private = false) @events.respond_to?(name, include_private) end def method_missing(method, *args, &block) @events.send(method, *args, &block) end end With `Module#delegate_missing_to`, the above is condensed to: class Partition delegate_missing_to :@events def initialize(first_event) @events = [ first_event ] end def people if @events.first.detail.people.any? @events.collect { |e| Array(e.detail.people) }.flatten.uniq else @events.collect(&:creator).uniq end end end David suggested it in #23824. | ||||
* | | Remove duplicated `test_` prefix [ci skip] | Ryuta Kamizono | 2016-03-02 | 1 | -1/+1 |
| | | |||||
* | | Deprecate `Module.local_constants` | yui-knk | 2016-03-01 | 1 | -1/+7 |
|/ | | | | | After Ruby 1.9, we can easily get the constants that have been defined locally by `Module.constants(false)`. | ||||
* | Fixing issue when delegating to methods named "block", "args", or "arg" | Jake Bell | 2015-08-19 | 1 | -0/+15 |
| | |||||
* | Deprecate alias_method_chain in favour of Module#prepend | Kir Shatrov | 2015-03-22 | 1 | -95/+125 |
| | | | …as discussed #19413 | ||||
* | Revert 88d08f2ec9f89ba431cba8d0c06ac9ebc204bbbb | Rafael Mendonça França | 2015-02-11 | 1 | -1/+1 |
| | | | | | | | 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 | ||||
* | Delegation works with reserved words passed to `:to` | Agis- | 2014-09-19 | 1 | -0/+11 |
| | | | | Fixes #16956. | ||||
* | Fix confusing exception in ActiveSupport delegation | Vladimir Yarotsky | 2014-05-20 | 1 | -1/+1 |
| | |||||
* | Remove warning | Rafael Mendonça França | 2014-01-16 | 1 | -2/+2 |
| | |||||
* | define the delegate methods on one line. fixes #13724 | Aaron Patterson | 2014-01-16 | 1 | -0/+10 |
| | | | | sup haters | ||||
* | Unused classes in AS tests | Akira Matsuda | 2013-12-19 | 1 | -6/+0 |
| | |||||
* | Only raise DelegationError if it's is the source of the exception | Andrew White | 2013-07-11 | 1 | -0/+27 |
| | | | | | | | | | 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 | ||||
* | Fixed test broken by local_constant_names | Arun Agrawal | 2013-07-03 | 1 | -6/+0 |
| | | | depreciation removed | ||||
* | Move delegation error constant to inside Module | Carlos Antonio da Silva | 2013-06-26 | 1 | -1/+1 |
| | |||||
* | Add DelegationError class. Rasied by delegation to a nil object | Steve Faulkner | 2013-06-26 | 1 | -1/+1 |
| | |||||
* | Module#delegate checks nilness rather that falsehood if :allow_nil is true, ↵ | Xavier Noria | 2013-04-26 | 1 | -0/+31 |
| | | | | | | | | | | | | | | 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 bug | Li Ellis Gallardo | 2013-04-25 | 1 | -0/+5 |
| | | | | | | 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. | ||||
* | Nice and easy delegation to the class | Marc-Andre Lafortune | 2012-09-11 | 1 | -0/+11 |
| |