public
Description: Adds a helper method for creating new modules and classes at runtime
Homepage: http://www.pluginaweek.org
Clone URL: git://github.com/pluginaweek/module_creation_helper.git
Add documentation about setting the parent
obrie (author)
Sun Jul 06 20:15:37 -0700 2008
commit  aaa0b14eb2d1968e08a1857224d2683e1dd367e8
tree    7ad593e21659b706f628c5d7c4b82c9e43b1f930
parent  16c3c7dbf6198654080ed251d4644110757f25d7
...
26
27
28
 
 
 
 
 
 
 
 
 
 
 
29
30
31
...
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
0
@@ -26,6 +26,17 @@ module PluginAWeek #:nodoc:
0
         # Class.create('Widdle', :parent => Waddle) # => Waddle::Widdle
0
         # Class.create('Woddle', :superclass => Waddle::Widdle, :parent => Waddle) # => Waddle::Woddle
0
         # Waddle::Woddle.superclass # => Waddle::Widdle
0
+ #
0
+ # == Setting the parent
0
+ #
0
+ # Rather than setting the parent directly using the +parent+ configuration
0
+ # option, you can specify it in the actual name of the class like so:
0
+ #
0
+ # Module.create('Foo::Bar') # => Foo::Bar
0
+ #
0
+ # This has the same effect as the following:
0
+ #
0
+ # Module.create('Bar', :parent => Foo)
0
         def create(name, options = {}, &block)
0
           # Validate the provided options
0
           invalid_options = options.keys - [:superclass, :parent]

Comments

    No one has commented yet.