diff options
author | Xavier Noria <fxn@hashref.com> | 2010-08-05 01:15:57 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-08-05 01:15:57 +0200 |
commit | 3cbe111439b22f11670587e2ec6779533dd77090 (patch) | |
tree | 541ec151c0899e21c3bef1c4b7ad9136b42f9b2f /activesupport/lib/active_support/concern.rb | |
parent | ec736dff7b0a05d58d4c8780863afc47e2bb74a3 (diff) | |
parent | d191db76e04f065e1b0cff3766c818f9b8e2f43a (diff) | |
download | rails-3cbe111439b22f11670587e2ec6779533dd77090.tar.gz rails-3cbe111439b22f11670587e2ec6779533dd77090.tar.bz2 rails-3cbe111439b22f11670587e2ec6779533dd77090.zip |
Merge remote branch 'docrails/master'
Diffstat (limited to 'activesupport/lib/active_support/concern.rb')
-rw-r--r-- | activesupport/lib/active_support/concern.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/concern.rb b/activesupport/lib/active_support/concern.rb index eb31f7cad4..408d327dd7 100644 --- a/activesupport/lib/active_support/concern.rb +++ b/activesupport/lib/active_support/concern.rb @@ -1,3 +1,38 @@ +# A typical module looks like this +# +# module M +# def self.included(base) +# base.send(:extend, ClassMethods) +# base.send(:include, InstanceMethods) +# scope :foo, :conditions => {:created_at => nil} +# end +# +# module ClassMethods +# def cm; puts 'I am class method'; end +# end +# +# module InstanceMethods +# def im; puts 'I am instance method'; end +# end +# end +# +# By using <tt>ActiveSupport::Concern</tt> above module could be written as: +# +# module M +# extend ActiveSupport::Concern +# +# included do +# scope :foo, :conditions => {:created_at => nil} +# end +# +# module ClassMethods +# def cm; puts 'I am class method'; end +# end +# +# module InstanceMethods +# def im; puts 'I am instance method'; end +# end +# end module ActiveSupport module Concern def self.extended(base) |