public
Description: Examples of AOP with Merb and Datamapper
Homepage: http://mcf1986.com
Clone URL: git://github.com/deimos1986/merb-meet-aop.git
Search Repo:
rename aspect and add a little styling
deimos1986 (author)
Thu Mar 27 10:15:47 -0700 2008
commit  bdcb2e97512ec621e5728bac61a6584e21a62cec
tree    122d6ab11df7d0cfaf2d317181ff10bac3f512b3
parent  e762fe6d42dfec67b23ce7b8ef25f40aea11eb64
...
1
2
3
4
 
 
 
 
 
 
...
 
1
 
2
3
4
5
6
7
8
0
@@ -1,3 +1,7 @@
0
-<center><h1>These are not the droids you are looking for</h1>
0
 
0
-<img src="/images/R2andC3PO.jpg"></img></center>
0
\ No newline at end of file
0
+<div id="center-container">
0
+<h1>These are not the droids you are looking 404</h1>
0
+<img src="/images/R2andC3PO.jpg"></img>
0
+</div>
0
+
0
+
...
3
4
5
6
 
 
 
7
8
9
10
...
3
4
5
 
6
7
8
9
10
11
12
0
@@ -3,7 +3,9 @@
0
 <ul>
0
 <% @users.each do |u| %>
0
   
0
- <li><%= u.name %></li>
0
+ <li>User: <%= u.id %><br />
0
+ Name: <%= u.name %>
0
+ </li>
0
   
0
 <% end %>
0
 </ul>
0
\ No newline at end of file
...
1
2
3
4
5
6
 
...
 
 
 
 
 
1
2
0
@@ -1,5 +1 @@
0
-<h1>Users controller, show action</h1>
0
-
0
-<p>Edit this file in <tt>app/views/users/show.html.erb</tt></p>
0
-
0
-<%= @user %>
0
\ No newline at end of file
0
+<h1>This is <%= @user %>'s page</h1>
...
4
5
6
7
8
 
9
10
11
...
4
5
6
 
 
7
8
9
10
0
@@ -4,8 +4,7 @@ module ExceptionHandler
0
     include Singleton
0
 
0
     @classes = [Users]
0
- @methods = [:show, :edit, :update, :destroy]
0
- @pointcut = Pointcut.new :calls_to => @methods, :on_type => @classes
0
+ @pointcut = Pointcut.new :on_type => @classes, :method_options => :exclude_ancestor_methods
0
   
0
     def self.catch_object_not_found_error
0
       Aspect.new :around, :pointcut => @pointcut do |join_point, object, *args|
...
1
 
2
3
4
5
6
7
 
 
 
 
8
9
10
11
12
13
14
 
 
 
 
 
 
 
15
16
17
18
19
20
21
22
23
...
 
1
2
 
 
 
 
 
3
4
5
6
7
 
 
 
 
 
 
8
9
10
11
12
13
14
15
16
17
 
18
19
 
20
21
0
@@ -1,23 +1,21 @@
0
-## trying to advise application sub classes isnt working :(
0
+## trying to advise application and it's sub classes isnt working :(
0
 
0
-module ExceptionHandler2; end
0
-
0
-class ExceptionHandler2::Aspects
0
- include Aquarium::Aspects::DSL::AspectDSL
0
- include Singleton
0
+module ExceptionHandler2
0
+ class Aspects
0
+ include Aquarium::Aspects::DSL::AspectDSL
0
+ include Singleton
0
   
0
- def self.catch_object_not_found_error
0
- around :classes_and_descendents => Application, :method_options => :exclude_ancestor_methods do |join_point, object, *args|
0
- begin
0
- puts "-" * 50
0
- join_point.proceed # call the wrapped join point
0
- puts "-" * 50
0
+ def self.catch_object_not_found_error
0
+ around :classes_and_descendents => Application, :method_options => :exclude_ancestor_methods do |join_point, object, *args|
0
+ begin
0
+ puts "-" * 50
0
+ join_point.proceed # call the wrapped join point
0
+ puts "-" * 50
0
+ end
0
       end
0
     end
0
   end
0
-
0
 end
0
 
0
-
0
 # ExceptionHandler2::Aspects.catch_object_not_found_error
0
 
...
1
2
3
 
4
 
5
6
7
...
40
41
42
43
 
44
45
46
...
75
76
77
78
 
79
80
81
...
116
117
118
 
 
 
 
 
 
 
 
 
 
119
120
...
1
2
 
3
4
5
6
7
8
...
41
42
43
 
44
45
46
47
...
76
77
78
 
79
80
81
82
...
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
0
@@ -1,7 +1,8 @@
0
 body {
0
   font-family: Arial, Verdana, sans-serif;
0
- font-size: 12px;
0
+ font-size: 80px;
0
   background-color: #fff;
0
+ text-shadow: #999999 3px 3px 2px;
0
 }
0
 * {
0
   margin: 0px;
0
@@ -40,7 +41,7 @@ hr {
0
   text-align: left;
0
 }
0
 h1 {
0
- font-size: 28px;
0
+ font-size: 100px;
0
   color: #c55;
0
   background-color: #fff;
0
   font-family: Arial, Verdana, sans-serif;
0
@@ -75,7 +76,7 @@ h3 {
0
 
0
 #main-container {
0
   margin: 5px 5px 5px 260px;
0
- padding: 15px;
0
+ padding: 40px;
0
   border-left: 1px solid silver;
0
   min-height: 400px;
0
 }
0
@@ -116,4 +117,14 @@ a:hover {
0
 }
0
 #main-container ul {
0
   margin-left: 3.0em;
0
+}
0
+#center-container {
0
+ width: 85%;
0
+ margin-left: auto;
0
+ margin-right: auto;
0
+}
0
+#center-container img{
0
+ margin-left: auto;
0
+ margin-right: auto;
0
+ display: block;
0
 }
0
\ No newline at end of file

Comments

    No one has commented yet.