aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/module
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-09-20 18:47:57 -0300
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-09-20 18:50:53 -0300
commit1eef814e7a5048086aaee06a31a633db1ee098cc (patch)
tree57bb6dce64fd8ac786a55d5813f6793ae2771734 /activesupport/lib/active_support/core_ext/module
parent2ecfed2f5a750f7fb1474b8c9e72a77200f4b808 (diff)
downloadrails-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')
-rw-r--r--activesupport/lib/active_support/core_ext/module/delegation.rb12
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.