Actions
Feature #12495
closedMake "private" return the arguments again, for chaining
Feature #12495:
Make "private" return the arguments again, for chaining
Status:
Closed
Assignee:
-
Target version:
-
Description
Ruby 2.1 introduced the feature to make def foo return the symbol, so this could be used by things like private (see #3753):
You could use the same method to create your own decorators (name borrowed from Python)
Currently, this would work but cached private def foo() would not. private (and all other modifier functions) return the class on which it was called. It would be nice to exterminate those order-dependencies.
The attached patch fixes this. It includes three modes:
No arguments: return nil:
One argument: return the symbol. The would be the most common use case for this example.
Multiple arguments: return an array of the arguments:
Files
Actions