magic_userstamp 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +78 -8
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/init.rb +5 -7
- data/lib/magic_userstamp.rb +27 -0
- data/lib/{userstamp → magic_userstamp}/config.rb +11 -12
- data/lib/{userstamp → magic_userstamp}/controller.rb +2 -2
- data/lib/{userstamp → magic_userstamp}/event.rb +3 -3
- data/lib/{userstamp → magic_userstamp}/magic_columns.rb +3 -3
- data/lib/magic_userstamp/migration_helper.rb +17 -0
- data/lib/{userstamp → magic_userstamp}/stampable.rb +15 -15
- data/lib/{userstamp → magic_userstamp}/stamper.rb +5 -5
- data/magic_userstamp.gemspec +36 -29
- data/rdoc/classes/MagicUserstamp.html +233 -0
- data/rdoc/classes/MagicUserstamp/Config.html +408 -0
- data/rdoc/classes/MagicUserstamp/Config/Pattern.html +246 -0
- data/rdoc/classes/{Ddb → MagicUserstamp}/Controller.html +7 -7
- data/rdoc/classes/{Ddb/Controller/Userstamp → MagicUserstamp/Controller}/InstanceMethods.html +7 -7
- data/rdoc/classes/MagicUserstamp/Event.html +367 -0
- data/rdoc/classes/MagicUserstamp/MagicColumns.html +180 -0
- data/rdoc/classes/MagicUserstamp/MagicColumns/ClassMethods.html +225 -0
- data/rdoc/classes/MagicUserstamp/MagicUserstampError.html +111 -0
- data/rdoc/classes/{Ddb/Userstamp → MagicUserstamp}/MigrationHelper.html +8 -8
- data/rdoc/classes/MagicUserstamp/MigrationHelper/InstanceMethods.html +142 -0
- data/rdoc/classes/MagicUserstamp/Stampable.html +157 -0
- data/rdoc/classes/MagicUserstamp/Stampable/ClassMethods.html +259 -0
- data/rdoc/classes/{Ddb/Userstamp → MagicUserstamp}/Stamper.html +9 -9
- data/rdoc/classes/{Ddb/Userstamp → MagicUserstamp}/Stamper/ClassMethods.html +19 -19
- data/rdoc/classes/MagicUserstamp/Stamper/InstanceMethods.html +208 -0
- data/rdoc/created.rid +1 -1
- data/rdoc/files/README_rdoc.html +268 -0
- data/rdoc/files/lib/magic_userstamp/config_rb.html +108 -0
- data/rdoc/files/lib/magic_userstamp/controller_rb.html +108 -0
- data/rdoc/files/lib/{userstamp_rb.html → magic_userstamp/event_rb.html} +14 -7
- data/rdoc/files/lib/magic_userstamp/magic_columns_rb.html +108 -0
- data/rdoc/files/lib/{migration_helper_rb.html → magic_userstamp/migration_helper_rb.html} +12 -5
- data/rdoc/files/lib/magic_userstamp/stampable_rb.html +108 -0
- data/rdoc/files/lib/{stamper_rb.html → magic_userstamp/stamper_rb.html} +12 -5
- data/rdoc/files/lib/{stampable_rb.html → magic_userstamp_rb.html} +6 -6
- data/rdoc/fr_class_index.html +18 -13
- data/rdoc/fr_file_index.html +11 -9
- data/rdoc/fr_method_index.html +39 -9
- data/rdoc/index.html +7 -5
- data/spec/compatibility_stamping_spec.rb +3 -3
- data/spec/config_spec.rb +5 -5
- data/spec/magic_column_spec.rb +8 -8
- data/spec/resources/controllers/magic_userstamp_controller.rb +9 -0
- data/spec/resources/controllers/posts_controller.rb +2 -2
- data/spec/resources/controllers/users_controller.rb +2 -2
- data/spec/stamping_spec.rb +1 -1
- metadata +36 -29
- data/lib/userstamp.rb +0 -17
- data/lib/userstamp/migration_helper.rb +0 -17
- data/rdoc/classes/Ddb/Controller/Userstamp.html +0 -125
- data/rdoc/classes/Ddb/Userstamp.html +0 -121
- data/rdoc/classes/Ddb/Userstamp/MigrationHelper/InstanceMethods.html +0 -142
- data/rdoc/classes/Ddb/Userstamp/Stampable.html +0 -128
- data/rdoc/classes/Ddb/Userstamp/Stampable/ClassMethods.html +0 -222
- data/rdoc/classes/Ddb/Userstamp/Stamper/InstanceMethods.html +0 -207
- data/rdoc/files/CHANGELOG.html +0 -137
- data/rdoc/files/LICENSE.html +0 -129
- data/rdoc/files/README.html +0 -341
- data/spec/resources/controllers/userstamp_controller.rb +0 -9
@@ -0,0 +1,246 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: MagicUserstamp::Config::Pattern</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">MagicUserstamp::Config::Pattern</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/magic_userstamp/config_rb.html">
|
59
|
+
lib/magic_userstamp/config.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000029">args_for_stampable_on</a>
|
90
|
+
<a href="#M000027">new</a>
|
91
|
+
<a href="#M000028">stampable?</a>
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
|
98
|
+
<!-- if includes -->
|
99
|
+
|
100
|
+
<div id="section">
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
<div id="attribute-list">
|
107
|
+
<h3 class="section-bar">Attributes</h3>
|
108
|
+
|
109
|
+
<div class="name-list">
|
110
|
+
<table>
|
111
|
+
<tr class="top-aligned-row context-row">
|
112
|
+
<td class="context-item-name">column_name</td>
|
113
|
+
<td class="context-item-value"> [R] </td>
|
114
|
+
<td class="context-item-desc"></td>
|
115
|
+
</tr>
|
116
|
+
<tr class="top-aligned-row context-row">
|
117
|
+
<td class="context-item-name">event_name</td>
|
118
|
+
<td class="context-item-value"> [R] </td>
|
119
|
+
<td class="context-item-desc"></td>
|
120
|
+
</tr>
|
121
|
+
<tr class="top-aligned-row context-row">
|
122
|
+
<td class="context-item-name">options_for_stampable_on</td>
|
123
|
+
<td class="context-item-value"> [R] </td>
|
124
|
+
<td class="context-item-desc"></td>
|
125
|
+
</tr>
|
126
|
+
<tr class="top-aligned-row context-row">
|
127
|
+
<td class="context-item-name">stampable_class_names</td>
|
128
|
+
<td class="context-item-value"> [R] </td>
|
129
|
+
<td class="context-item-desc"></td>
|
130
|
+
</tr>
|
131
|
+
<tr class="top-aligned-row context-row">
|
132
|
+
<td class="context-item-name">stamper_attr_name</td>
|
133
|
+
<td class="context-item-value"> [R] </td>
|
134
|
+
<td class="context-item-desc"></td>
|
135
|
+
</tr>
|
136
|
+
<tr class="top-aligned-row context-row">
|
137
|
+
<td class="context-item-name">stamper_class_name</td>
|
138
|
+
<td class="context-item-value"> [R] </td>
|
139
|
+
<td class="context-item-desc"></td>
|
140
|
+
</tr>
|
141
|
+
</table>
|
142
|
+
</div>
|
143
|
+
</div>
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
<!-- if method_list -->
|
148
|
+
<div id="methods">
|
149
|
+
<h3 class="section-bar">Public Class methods</h3>
|
150
|
+
|
151
|
+
<div id="method-M000027" class="method-detail">
|
152
|
+
<a name="M000027"></a>
|
153
|
+
|
154
|
+
<div class="method-heading">
|
155
|
+
<a href="#M000027" class="method-signature">
|
156
|
+
<span class="method-name">new</span><span class="method-args">(event_name, column_name, options = nil)</span>
|
157
|
+
</a>
|
158
|
+
</div>
|
159
|
+
|
160
|
+
<div class="method-description">
|
161
|
+
<p><a class="source-toggle" href="#"
|
162
|
+
onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
|
163
|
+
<div class="method-source-code" id="M000027-source">
|
164
|
+
<pre>
|
165
|
+
<span class="ruby-comment cmt"># File lib/magic_userstamp/config.rb, line 91</span>
|
166
|
+
91: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">event_name</span>, <span class="ruby-identifier">column_name</span>, <span class="ruby-identifier">options</span> = <span class="ruby-keyword kw">nil</span>)
|
167
|
+
92: <span class="ruby-ivar">@event_name</span> = <span class="ruby-identifier">event_name</span>
|
168
|
+
93: <span class="ruby-ivar">@column_name</span> = <span class="ruby-identifier">column_name</span>
|
169
|
+
94: <span class="ruby-identifier">options</span> = {
|
170
|
+
95: <span class="ruby-identifier">:stampable_class_names</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">nil</span>,
|
171
|
+
96: <span class="ruby-identifier">:stamper_class_name</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'User'</span>,
|
172
|
+
97: <span class="ruby-identifier">:stamper_attr_name</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">nil</span> <span class="ruby-comment cmt"># sholuld not be only 'id' but PK column name</span>
|
173
|
+
98: }.<span class="ruby-identifier">update</span>(<span class="ruby-identifier">options</span> <span class="ruby-operator">||</span> {})
|
174
|
+
99: <span class="ruby-ivar">@stampable_class_names</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:stampable_class_names</span>)
|
175
|
+
100: <span class="ruby-constant">MagicUserstamp</span><span class="ruby-operator">::</span><span class="ruby-constant">Stampable</span>.<span class="ruby-identifier">raise_unless_valid_options_for_stampable_on</span>(<span class="ruby-identifier">options</span>)
|
176
|
+
101: <span class="ruby-ivar">@options_for_stampable_on</span> = <span class="ruby-identifier">options</span>
|
177
|
+
102: <span class="ruby-ivar">@stamper_class_name</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:stamper_class_name</span>]
|
178
|
+
103: <span class="ruby-ivar">@stamper_attr_name</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:stamper_attr_name</span>]
|
179
|
+
104: <span class="ruby-keyword kw">end</span>
|
180
|
+
</pre>
|
181
|
+
</div>
|
182
|
+
</div>
|
183
|
+
</div>
|
184
|
+
|
185
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
186
|
+
|
187
|
+
<div id="method-M000029" class="method-detail">
|
188
|
+
<a name="M000029"></a>
|
189
|
+
|
190
|
+
<div class="method-heading">
|
191
|
+
<a href="#M000029" class="method-signature">
|
192
|
+
<span class="method-name">args_for_stampable_on</span><span class="method-args">(column_name = nil)</span>
|
193
|
+
</a>
|
194
|
+
</div>
|
195
|
+
|
196
|
+
<div class="method-description">
|
197
|
+
<p><a class="source-toggle" href="#"
|
198
|
+
onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
|
199
|
+
<div class="method-source-code" id="M000029-source">
|
200
|
+
<pre>
|
201
|
+
<span class="ruby-comment cmt"># File lib/magic_userstamp/config.rb, line 111</span>
|
202
|
+
111: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">args_for_stampable_on</span>(<span class="ruby-identifier">column_name</span> = <span class="ruby-keyword kw">nil</span>)
|
203
|
+
112: [<span class="ruby-identifier">event_name</span>, {<span class="ruby-identifier">:attribute</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">column_name</span> <span class="ruby-operator">||</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">column_name</span>}.<span class="ruby-identifier">update</span>(<span class="ruby-ivar">@options_for_stampable_on</span>)]
|
204
|
+
113: <span class="ruby-keyword kw">end</span>
|
205
|
+
</pre>
|
206
|
+
</div>
|
207
|
+
</div>
|
208
|
+
</div>
|
209
|
+
|
210
|
+
<div id="method-M000028" class="method-detail">
|
211
|
+
<a name="M000028"></a>
|
212
|
+
|
213
|
+
<div class="method-heading">
|
214
|
+
<a href="#M000028" class="method-signature">
|
215
|
+
<span class="method-name">stampable?</span><span class="method-args">(klass, column_name)</span>
|
216
|
+
</a>
|
217
|
+
</div>
|
218
|
+
|
219
|
+
<div class="method-description">
|
220
|
+
<p><a class="source-toggle" href="#"
|
221
|
+
onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
|
222
|
+
<div class="method-source-code" id="M000028-source">
|
223
|
+
<pre>
|
224
|
+
<span class="ruby-comment cmt"># File lib/magic_userstamp/config.rb, line 106</span>
|
225
|
+
106: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stampable?</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">column_name</span>)
|
226
|
+
107: (<span class="ruby-identifier">stampable_class_names</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">true</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">stampable_class_names</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">name</span>)) <span class="ruby-operator">&&</span>
|
227
|
+
108: (<span class="ruby-identifier">column_name</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">column_name</span>.<span class="ruby-identifier">to_s</span>)
|
228
|
+
109: <span class="ruby-keyword kw">end</span>
|
229
|
+
</pre>
|
230
|
+
</div>
|
231
|
+
</div>
|
232
|
+
</div>
|
233
|
+
|
234
|
+
|
235
|
+
</div>
|
236
|
+
|
237
|
+
|
238
|
+
</div>
|
239
|
+
|
240
|
+
|
241
|
+
<div id="validator-badges">
|
242
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
243
|
+
</div>
|
244
|
+
|
245
|
+
</body>
|
246
|
+
</html>
|
@@ -1,12 +1,12 @@
|
|
1
|
-
<?xml version="1.0" encoding="
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
2
|
<!DOCTYPE html
|
3
3
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
4
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
5
|
|
6
6
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
7
|
<head>
|
8
|
-
<title>Module:
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=
|
8
|
+
<title>Module: MagicUserstamp::Controller</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
10
10
|
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
11
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
12
|
<script type="text/javascript">
|
@@ -50,13 +50,13 @@
|
|
50
50
|
<table class="header-table">
|
51
51
|
<tr class="top-aligned-row">
|
52
52
|
<td><strong>Module</strong></td>
|
53
|
-
<td class="class-name-in-header">
|
53
|
+
<td class="class-name-in-header">MagicUserstamp::Controller</td>
|
54
54
|
</tr>
|
55
55
|
<tr class="top-aligned-row">
|
56
56
|
<td><strong>In:</strong></td>
|
57
57
|
<td>
|
58
|
-
<a href="../../files/lib/
|
59
|
-
lib/
|
58
|
+
<a href="../../files/lib/magic_userstamp/controller_rb.html">
|
59
|
+
lib/magic_userstamp/controller.rb
|
60
60
|
</a>
|
61
61
|
<br />
|
62
62
|
</td>
|
@@ -87,7 +87,7 @@
|
|
87
87
|
<div id="class-list">
|
88
88
|
<h3 class="section-bar">Classes and Modules</h3>
|
89
89
|
|
90
|
-
Module <a href="Controller/
|
90
|
+
Module <a href="Controller/InstanceMethods.html" class="link">MagicUserstamp::Controller::InstanceMethods</a><br />
|
91
91
|
|
92
92
|
</div>
|
93
93
|
|
data/rdoc/classes/{Ddb/Controller/Userstamp → MagicUserstamp/Controller}/InstanceMethods.html
RENAMED
@@ -1,14 +1,14 @@
|
|
1
|
-
<?xml version="1.0" encoding="
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
2
|
<!DOCTYPE html
|
3
3
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
4
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
5
|
|
6
6
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
7
|
<head>
|
8
|
-
<title>Module:
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=
|
8
|
+
<title>Module: MagicUserstamp::Controller::InstanceMethods</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
10
10
|
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href="
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
12
|
<script type="text/javascript">
|
13
13
|
// <![CDATA[
|
14
14
|
|
@@ -50,13 +50,13 @@
|
|
50
50
|
<table class="header-table">
|
51
51
|
<tr class="top-aligned-row">
|
52
52
|
<td><strong>Module</strong></td>
|
53
|
-
<td class="class-name-in-header">
|
53
|
+
<td class="class-name-in-header">MagicUserstamp::Controller::InstanceMethods</td>
|
54
54
|
</tr>
|
55
55
|
<tr class="top-aligned-row">
|
56
56
|
<td><strong>In:</strong></td>
|
57
57
|
<td>
|
58
|
-
<a href="
|
59
|
-
lib/
|
58
|
+
<a href="../../../files/lib/magic_userstamp/controller_rb.html">
|
59
|
+
lib/magic_userstamp/controller.rb
|
60
60
|
</a>
|
61
61
|
<br />
|
62
62
|
</td>
|
@@ -0,0 +1,367 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: MagicUserstamp::Event</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">MagicUserstamp::Event</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/magic_userstamp/event_rb.html">
|
59
|
+
lib/magic_userstamp/event.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000032">[]</a>
|
90
|
+
<a href="#M000034">actor_name</a>
|
91
|
+
<a href="#M000031">create</a>
|
92
|
+
<a href="#M000033">each</a>
|
93
|
+
<a href="#M000030">new</a>
|
94
|
+
<a href="#M000037">raise_unless_valid_name</a>
|
95
|
+
<a href="#M000036">valid_name?</a>
|
96
|
+
<a href="#M000035">valid_names</a>
|
97
|
+
</div>
|
98
|
+
</div>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
|
103
|
+
<!-- if includes -->
|
104
|
+
|
105
|
+
<div id="section">
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
<div id="attribute-list">
|
112
|
+
<h3 class="section-bar">Attributes</h3>
|
113
|
+
|
114
|
+
<div class="name-list">
|
115
|
+
<table>
|
116
|
+
<tr class="top-aligned-row context-row">
|
117
|
+
<td class="context-item-name">actor</td>
|
118
|
+
<td class="context-item-value"> [R] </td>
|
119
|
+
<td class="context-item-desc"></td>
|
120
|
+
</tr>
|
121
|
+
<tr class="top-aligned-row context-row">
|
122
|
+
<td class="context-item-name">actual_hook</td>
|
123
|
+
<td class="context-item-value"> [R] </td>
|
124
|
+
<td class="context-item-desc"></td>
|
125
|
+
</tr>
|
126
|
+
<tr class="top-aligned-row context-row">
|
127
|
+
<td class="context-item-name">after_callback</td>
|
128
|
+
<td class="context-item-value"> [R] </td>
|
129
|
+
<td class="context-item-desc"></td>
|
130
|
+
</tr>
|
131
|
+
<tr class="top-aligned-row context-row">
|
132
|
+
<td class="context-item-name">default_attribute</td>
|
133
|
+
<td class="context-item-value"> [R] </td>
|
134
|
+
<td class="context-item-desc"></td>
|
135
|
+
</tr>
|
136
|
+
<tr class="top-aligned-row context-row">
|
137
|
+
<td class="context-item-name">default_attribute_compatible</td>
|
138
|
+
<td class="context-item-value"> [R] </td>
|
139
|
+
<td class="context-item-desc"></td>
|
140
|
+
</tr>
|
141
|
+
<tr class="top-aligned-row context-row">
|
142
|
+
<td class="context-item-name">name</td>
|
143
|
+
<td class="context-item-value"> [R] </td>
|
144
|
+
<td class="context-item-desc"></td>
|
145
|
+
</tr>
|
146
|
+
</table>
|
147
|
+
</div>
|
148
|
+
</div>
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
<!-- if method_list -->
|
153
|
+
<div id="methods">
|
154
|
+
<h3 class="section-bar">Public Class methods</h3>
|
155
|
+
|
156
|
+
<div id="method-M000032" class="method-detail">
|
157
|
+
<a name="M000032"></a>
|
158
|
+
|
159
|
+
<div class="method-heading">
|
160
|
+
<a href="#M000032" class="method-signature">
|
161
|
+
<span class="method-name">[]</span><span class="method-args">(event_name)</span>
|
162
|
+
</a>
|
163
|
+
</div>
|
164
|
+
|
165
|
+
<div class="method-description">
|
166
|
+
<p><a class="source-toggle" href="#"
|
167
|
+
onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
|
168
|
+
<div class="method-source-code" id="M000032-source">
|
169
|
+
<pre>
|
170
|
+
<span class="ruby-comment cmt"># File lib/magic_userstamp/event.rb, line 31</span>
|
171
|
+
31: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">event_name</span>)
|
172
|
+
32: <span class="ruby-identifier">raise_unless_valid_name</span>(<span class="ruby-identifier">event_name</span>)
|
173
|
+
33: <span class="ruby-ivar">@name_hash</span>[<span class="ruby-identifier">event_name</span>]
|
174
|
+
34: <span class="ruby-keyword kw">end</span>
|
175
|
+
</pre>
|
176
|
+
</div>
|
177
|
+
</div>
|
178
|
+
</div>
|
179
|
+
|
180
|
+
<div id="method-M000034" class="method-detail">
|
181
|
+
<a name="M000034"></a>
|
182
|
+
|
183
|
+
<div class="method-heading">
|
184
|
+
<a href="#M000034" class="method-signature">
|
185
|
+
<span class="method-name">actor_name</span><span class="method-args">(event_name)</span>
|
186
|
+
</a>
|
187
|
+
</div>
|
188
|
+
|
189
|
+
<div class="method-description">
|
190
|
+
<p><a class="source-toggle" href="#"
|
191
|
+
onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
|
192
|
+
<div class="method-source-code" id="M000034-source">
|
193
|
+
<pre>
|
194
|
+
<span class="ruby-comment cmt"># File lib/magic_userstamp/event.rb, line 41</span>
|
195
|
+
41: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">actor_name</span>(<span class="ruby-identifier">event_name</span>)
|
196
|
+
42: <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">event_name</span>].<span class="ruby-identifier">actor</span>
|
197
|
+
43: <span class="ruby-keyword kw">end</span>
|
198
|
+
</pre>
|
199
|
+
</div>
|
200
|
+
</div>
|
201
|
+
</div>
|
202
|
+
|
203
|
+
<div id="method-M000031" class="method-detail">
|
204
|
+
<a name="M000031"></a>
|
205
|
+
|
206
|
+
<div class="method-heading">
|
207
|
+
<a href="#M000031" class="method-signature">
|
208
|
+
<span class="method-name">create</span><span class="method-args">(name, actor, default_attribute_compatible, options = nil, &block)</span>
|
209
|
+
</a>
|
210
|
+
</div>
|
211
|
+
|
212
|
+
<div class="method-description">
|
213
|
+
<p><a class="source-toggle" href="#"
|
214
|
+
onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
|
215
|
+
<div class="method-source-code" id="M000031-source">
|
216
|
+
<pre>
|
217
|
+
<span class="ruby-comment cmt"># File lib/magic_userstamp/event.rb, line 22</span>
|
218
|
+
22: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">actor</span>, <span class="ruby-identifier">default_attribute_compatible</span>, <span class="ruby-identifier">options</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
219
|
+
23: <span class="ruby-identifier">result</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">actor</span>, <span class="ruby-identifier">default_attribute_compatible</span>, <span class="ruby-identifier">options</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
220
|
+
24: <span class="ruby-ivar">@name_hash</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">HashWithIndifferentAccess</span>.<span class="ruby-identifier">new</span>
|
221
|
+
25: <span class="ruby-ivar">@name_hash</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">result</span>
|
222
|
+
26: <span class="ruby-ivar">@instances</span> <span class="ruby-operator">||=</span> []
|
223
|
+
27: <span class="ruby-ivar">@instances</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">result</span>
|
224
|
+
28: <span class="ruby-identifier">result</span>
|
225
|
+
29: <span class="ruby-keyword kw">end</span>
|
226
|
+
</pre>
|
227
|
+
</div>
|
228
|
+
</div>
|
229
|
+
</div>
|
230
|
+
|
231
|
+
<div id="method-M000033" class="method-detail">
|
232
|
+
<a name="M000033"></a>
|
233
|
+
|
234
|
+
<div class="method-heading">
|
235
|
+
<a href="#M000033" class="method-signature">
|
236
|
+
<span class="method-name">each</span><span class="method-args">(&block)</span>
|
237
|
+
</a>
|
238
|
+
</div>
|
239
|
+
|
240
|
+
<div class="method-description">
|
241
|
+
<p><a class="source-toggle" href="#"
|
242
|
+
onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
|
243
|
+
<div class="method-source-code" id="M000033-source">
|
244
|
+
<pre>
|
245
|
+
<span class="ruby-comment cmt"># File lib/magic_userstamp/event.rb, line 36</span>
|
246
|
+
36: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
247
|
+
37: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block</span>
|
248
|
+
38: (<span class="ruby-ivar">@instances</span> <span class="ruby-operator">||</span> []).<span class="ruby-identifier">each</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
249
|
+
39: <span class="ruby-keyword kw">end</span>
|
250
|
+
</pre>
|
251
|
+
</div>
|
252
|
+
</div>
|
253
|
+
</div>
|
254
|
+
|
255
|
+
<div id="method-M000030" class="method-detail">
|
256
|
+
<a name="M000030"></a>
|
257
|
+
|
258
|
+
<div class="method-heading">
|
259
|
+
<a href="#M000030" class="method-signature">
|
260
|
+
<span class="method-name">new</span><span class="method-args">(name, actor, default_attribute_compatible, options = nil)</span>
|
261
|
+
</a>
|
262
|
+
</div>
|
263
|
+
|
264
|
+
<div class="method-description">
|
265
|
+
<p><a class="source-toggle" href="#"
|
266
|
+
onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
|
267
|
+
<div class="method-source-code" id="M000030-source">
|
268
|
+
<pre>
|
269
|
+
<span class="ruby-comment cmt"># File lib/magic_userstamp/event.rb, line 10</span>
|
270
|
+
10: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">actor</span>, <span class="ruby-identifier">default_attribute_compatible</span>, <span class="ruby-identifier">options</span> = <span class="ruby-keyword kw">nil</span>)
|
271
|
+
11: <span class="ruby-ivar">@name</span>, <span class="ruby-ivar">@actor</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">actor</span>.<span class="ruby-identifier">to_s</span>
|
272
|
+
12: <span class="ruby-ivar">@default_attribute</span> = <span class="ruby-node">"#{@actor}_id"</span>
|
273
|
+
13: <span class="ruby-ivar">@default_attribute_compatible</span> = <span class="ruby-identifier">default_attribute_compatible</span>
|
274
|
+
14: <span class="ruby-identifier">options</span> = {
|
275
|
+
15: <span class="ruby-identifier">:actual_hook</span> =<span class="ruby-operator">></span> <span class="ruby-node">"before_#{@name.to_s}"</span>
|
276
|
+
16: }.<span class="ruby-identifier">update</span>(<span class="ruby-identifier">options</span> <span class="ruby-operator">||</span> {})
|
277
|
+
17: <span class="ruby-ivar">@actual_hook</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:actual_hook</span>]
|
278
|
+
18: <span class="ruby-ivar">@after_callback</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:after_callback</span>]
|
279
|
+
19: <span class="ruby-keyword kw">end</span>
|
280
|
+
</pre>
|
281
|
+
</div>
|
282
|
+
</div>
|
283
|
+
</div>
|
284
|
+
|
285
|
+
<div id="method-M000037" class="method-detail">
|
286
|
+
<a name="M000037"></a>
|
287
|
+
|
288
|
+
<div class="method-heading">
|
289
|
+
<a href="#M000037" class="method-signature">
|
290
|
+
<span class="method-name">raise_unless_valid_name</span><span class="method-args">(event_name)</span>
|
291
|
+
</a>
|
292
|
+
</div>
|
293
|
+
|
294
|
+
<div class="method-description">
|
295
|
+
<p><a class="source-toggle" href="#"
|
296
|
+
onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
|
297
|
+
<div class="method-source-code" id="M000037-source">
|
298
|
+
<pre>
|
299
|
+
<span class="ruby-comment cmt"># File lib/magic_userstamp/event.rb, line 53</span>
|
300
|
+
53: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">raise_unless_valid_name</span>(<span class="ruby-identifier">event_name</span>)
|
301
|
+
54: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">valid_name?</span>(<span class="ruby-identifier">event_name</span>)
|
302
|
+
55: <span class="ruby-identifier">raise</span> <span class="ruby-constant">MagicUserstampError</span>, <span class="ruby-node">"Invalid event name '#{event_name.inspect}'. Event name must be one of #{valid_names.inspect}"</span>
|
303
|
+
56: <span class="ruby-keyword kw">end</span>
|
304
|
+
</pre>
|
305
|
+
</div>
|
306
|
+
</div>
|
307
|
+
</div>
|
308
|
+
|
309
|
+
<div id="method-M000036" class="method-detail">
|
310
|
+
<a name="M000036"></a>
|
311
|
+
|
312
|
+
<div class="method-heading">
|
313
|
+
<a href="#M000036" class="method-signature">
|
314
|
+
<span class="method-name">valid_name?</span><span class="method-args">(event_name)</span>
|
315
|
+
</a>
|
316
|
+
</div>
|
317
|
+
|
318
|
+
<div class="method-description">
|
319
|
+
<p><a class="source-toggle" href="#"
|
320
|
+
onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
|
321
|
+
<div class="method-source-code" id="M000036-source">
|
322
|
+
<pre>
|
323
|
+
<span class="ruby-comment cmt"># File lib/magic_userstamp/event.rb, line 49</span>
|
324
|
+
49: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">valid_name?</span>(<span class="ruby-identifier">event_name</span>)
|
325
|
+
50: <span class="ruby-identifier">valid_names</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">event_name</span>.<span class="ruby-identifier">to_s</span>)
|
326
|
+
51: <span class="ruby-keyword kw">end</span>
|
327
|
+
</pre>
|
328
|
+
</div>
|
329
|
+
</div>
|
330
|
+
</div>
|
331
|
+
|
332
|
+
<div id="method-M000035" class="method-detail">
|
333
|
+
<a name="M000035"></a>
|
334
|
+
|
335
|
+
<div class="method-heading">
|
336
|
+
<a href="#M000035" class="method-signature">
|
337
|
+
<span class="method-name">valid_names</span><span class="method-args">()</span>
|
338
|
+
</a>
|
339
|
+
</div>
|
340
|
+
|
341
|
+
<div class="method-description">
|
342
|
+
<p><a class="source-toggle" href="#"
|
343
|
+
onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
|
344
|
+
<div class="method-source-code" id="M000035-source">
|
345
|
+
<pre>
|
346
|
+
<span class="ruby-comment cmt"># File lib/magic_userstamp/event.rb, line 45</span>
|
347
|
+
45: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">valid_names</span>
|
348
|
+
46: (<span class="ruby-ivar">@instances</span> <span class="ruby-operator">||</span> []).<span class="ruby-identifier">map</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">:name</span>)
|
349
|
+
47: <span class="ruby-keyword kw">end</span>
|
350
|
+
</pre>
|
351
|
+
</div>
|
352
|
+
</div>
|
353
|
+
</div>
|
354
|
+
|
355
|
+
|
356
|
+
</div>
|
357
|
+
|
358
|
+
|
359
|
+
</div>
|
360
|
+
|
361
|
+
|
362
|
+
<div id="validator-badges">
|
363
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
364
|
+
</div>
|
365
|
+
|
366
|
+
</body>
|
367
|
+
</html>
|