From 1eef814e7a5048086aaee06a31a633db1ee098cc Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Thu, 20 Sep 2012 18:47:57 -0300 Subject: Add changelog entry and docs about class delegation using the symbol :class See #7613. [ci skip] --- .../lib/active_support/core_ext/module/delegation.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'activesupport/lib/active_support') 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 :prefix option. If the value # is true, the delegate methods are prefixed with the name of the object being # delegated to. -- cgit v1.2.3