aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/concern.rb
diff options
context:
space:
mode:
authorNeeraj Singh <neerajdotname@gmail.com>2010-08-04 17:02:38 -0400
committerNeeraj Singh <neerajdotname@gmail.com>2010-08-04 17:03:03 -0400
commit589e6977d72b232b6e1af5ef508beddffbcd5f4c (patch)
tree5e72068d4e0d9c7330d87c564625ea2f7b13614f /activesupport/lib/active_support/concern.rb
parent7745f716a175b680f140c7b735261e5a3064e7e9 (diff)
downloadrails-589e6977d72b232b6e1af5ef508beddffbcd5f4c.tar.gz
rails-589e6977d72b232b6e1af5ef508beddffbcd5f4c.tar.bz2
rails-589e6977d72b232b6e1af5ef508beddffbcd5f4c.zip
adding documentation to ActiveSupport::Concern ht:strictly typed for an awesome example
some minor documentation changes
Diffstat (limited to 'activesupport/lib/active_support/concern.rb')
-rw-r--r--activesupport/lib/active_support/concern.rb35
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)