diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-09-20 18:47:57 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-09-20 18:50:53 -0300 |
commit | 1eef814e7a5048086aaee06a31a633db1ee098cc (patch) | |
tree | 57bb6dce64fd8ac786a55d5813f6793ae2771734 /activesupport/lib/active_support/core_ext/module/delegation.rb | |
parent | 2ecfed2f5a750f7fb1474b8c9e72a77200f4b808 (diff) | |
download | rails-1eef814e7a5048086aaee06a31a633db1ee098cc.tar.gz rails-1eef814e7a5048086aaee06a31a633db1ee098cc.tar.bz2 rails-1eef814e7a5048086aaee06a31a633db1ee098cc.zip |
Add changelog entry and docs about class delegation using the symbol :class
See #7613. [ci skip]
Diffstat (limited to 'activesupport/lib/active_support/core_ext/module/delegation.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/module/delegation.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/delegation.rb b/activesupport/lib/active_support/core_ext/module/delegation.rb index 8703587243..29fd5cfc4d 100644 --- a/activesupport/lib/active_support/core_ext/module/delegation.rb +++ b/activesupport/lib/active_support/core_ext/module/delegation.rb @@ -52,6 +52,18 @@ class Module # Foo.new.min # => 4 # Foo.new.max # => 11 # + # It's also possible to delegate a method to the class by using +:class+: + # + # class Foo + # def self.hello + # "world" + # end + # + # delegate :hello, to: :class + # end + # + # Foo.new.hello # => "world" + # # Delegates can optionally be prefixed using the <tt>:prefix</tt> option. If the value # is <tt>true</tt>, the delegate methods are prefixed with the name of the object being # delegated to. |