GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Description: Resource-oriented open source Ruby framework for Web apps.
Homepage: http://rubywaves.com/
Clone URL: git://github.com/dyoder/waves.git
Further refinement of Foundations::Simple to ensure reloadability.
dyoder (author)
Mon Apr 21 01:24:46 -0700 2008
commit  7fd6daaa37d93ee8c3977cb44e4526f516af77cb
tree    fb0c90a55205cc7bb8f1499952da28601de6f382
parent  776a6d4ad958dab674527464c0e07eef59854941
...
2
3
4
 
 
 
 
 
 
 
 
5
6
 
7
8
9
 
 
 
10
11
12
13
14
15
16
17
18
19
20
21
22
 
 
 
 
23
24
25
...
2
3
4
5
6
7
8
9
10
11
12
13
 
14
15
16
 
17
18
19
20
21
22
 
 
 
 
 
 
 
 
 
 
23
24
25
26
27
28
29
0
@@ -2,24 +2,28 @@ module Waves
0
   module Foundations
0
     module Simple
0
       
0
+ module Reflection
0
+ def self.included( mod )
0
+ mod.module_eval do
0
+ def self.[]( cname ) const_get( cname.to_s.camel_case ) end
0
+ end
0
+ end
0
+ end
0
+
0
       def self.included( app )
0
-
0
+
0
         app.module_eval do
0
 
0
- const_set( :Configurations, Module.new {
0
+ extend Autocreate; extend Reloadable;
0
+ autocreate( :Configurations, Module.new {
0
+ include Reflection
0
             const_set( :Development, Class.new( Waves::Configurations::Default ))
0
             const_set( :Mapping, Module.new { |mod| extend Waves::Mapping })
0
           })
0
- const_set( :Models, Module.new )
0
- const_set( :Views, Module.new { include Waves::Views::Mixin })
0
- const_set( :Controllers, Module.new { include Waves::Controllers::Mixin })
0
- const_set( :Helpers, Module.new )
0
-
0
- %w( Configurations Models Views Controllers Helpers ).each do |name|
0
- const_get(name).module_eval do
0
- def self.[]( cname ) const_get( cname.to_s.camel_case ) end
0
- end
0
- end
0
+ autocreate( :Models, Module.new { include Reflection })
0
+ autocreate( :Views, Module.new { include Reflection; include Waves::Views::Mixin })
0
+ autocreate( :Controllers, Module.new { include Reflection; include Waves::Controllers::Mixin })
0
+ autocreate( :Helpers, Module.new { include Reflection })
0
           
0
           # accessor methods for modules and other key application objects ...
0
           class << self
...
1
2
3
4
5
6
7
8
9
 
 
 
 
 
 
 
10
11
12
13
14
15
 
 
 
 
 
 
16
17
18
...
1
2
3
 
 
 
 
 
 
4
5
6
7
8
9
10
11
 
 
 
 
 
12
13
14
15
16
17
18
19
20
0
@@ -1,18 +1,20 @@
0
 # require 'test_helper' because RubyMate needs help
0
 require File.join(File.dirname(__FILE__), "..", "helpers")
0
 
0
-module Test
0
- module Controllers
0
- class Animal
0
- include Waves::Controllers::Mixin
0
- def cow() 'Moo!' end
0
- end
0
+# Note: you have to define the resource classes using module_eval here, because otherwise
0
+# the autocreate code never gets triggered in the application.
0
+
0
+Test::Controllers.module_eval do
0
+ class Animal
0
+ include Waves::Controllers::Mixin
0
+ def cow() 'Moo!' end
0
   end
0
- module Views
0
- class Animal
0
- include Waves::Views::Mixin
0
- def say( says ) "This animal says: '#{says}'" end
0
- end
0
+end
0
+
0
+Test::Views.module_eval do
0
+ class Animal
0
+ include Waves::Views::Mixin
0
+ def say( says ) "This animal says: '#{says}'" end
0
   end
0
 end
0
 

Comments

    No one has commented yet.