Capcode 0.8.2 → 0.8.4

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.
Files changed (74) hide show
  1. data/{README → README.rdoc} +12 -1
  2. data/examples/haml/cf_layout.haml +1 -0
  3. data/examples/haml/style.sass +2 -0
  4. data/examples/render-erb.rb +14 -0
  5. data/examples/render-haml_sass.rb +22 -0
  6. data/examples/render-json.rb +13 -0
  7. data/examples/render-markaby.rb +27 -0
  8. data/examples/render-static.rb +18 -0
  9. data/examples/render-text.rb +12 -0
  10. data/examples/render-xml.rb +24 -0
  11. data/examples/rest.rb +77 -0
  12. data/examples/upload.rb +4 -4
  13. data/lib/capcode.rb +118 -44
  14. data/lib/capcode/base/db.rb +23 -0
  15. data/lib/capcode/base/dm.rb +11 -11
  16. data/lib/capcode/render/erb.rb +5 -3
  17. data/lib/capcode/render/haml.rb +3 -2
  18. data/lib/capcode/render/json.rb +1 -1
  19. data/lib/capcode/render/markaby.rb +5 -5
  20. data/lib/capcode/render/sass.rb +4 -2
  21. data/lib/capcode/render/static.rb +6 -2
  22. data/lib/capcode/render/text.rb +1 -1
  23. data/lib/capcode/render/xml.rb +3 -5
  24. data/lib/capcode/version.rb +1 -1
  25. metadata +25 -55
  26. data/doc/rdoc/classes/Capcode.html +0 -605
  27. data/doc/rdoc/classes/Capcode/HTTPError.html +0 -129
  28. data/doc/rdoc/classes/Capcode/Helpers.html +0 -342
  29. data/doc/rdoc/classes/Capcode/RenderError.html +0 -129
  30. data/doc/rdoc/classes/Capcode/Views.html +0 -108
  31. data/doc/rdoc/created.rid +0 -1
  32. data/doc/rdoc/files/AUTHORS.html +0 -103
  33. data/doc/rdoc/files/COPYING.html +0 -527
  34. data/doc/rdoc/files/README.html +0 -478
  35. data/doc/rdoc/files/lib/capcode_rb.html +0 -541
  36. data/doc/rdoc/index.html +0 -10
  37. data/doc/rdoc/permalink.gif +0 -0
  38. data/doc/rdoc/rdoc-style.css +0 -106
  39. data/doc/rdoc/rubyfr.png +0 -0
  40. data/doc/rdoc_iphone/classes/Capcode.html +0 -175
  41. data/doc/rdoc_iphone/classes/Capcode/HTTPError.html +0 -21
  42. data/doc/rdoc_iphone/classes/Capcode/Helpers.html +0 -153
  43. data/doc/rdoc_iphone/classes/Capcode/RenderError.html +0 -21
  44. data/doc/rdoc_iphone/classes/Capcode/Views.html +0 -21
  45. data/doc/rdoc_iphone/classes_index.html +0 -10
  46. data/doc/rdoc_iphone/created.rid +0 -1
  47. data/doc/rdoc_iphone/files/AUTHORS.html +0 -11
  48. data/doc/rdoc_iphone/files/COPYING.html +0 -435
  49. data/doc/rdoc_iphone/files/README.html +0 -325
  50. data/doc/rdoc_iphone/files/lib/capcode_rb.html +0 -435
  51. data/doc/rdoc_iphone/files_index.html +0 -7
  52. data/doc/rdoc_iphone/index.html +0 -51
  53. data/doc/rdoc_iphone/iui/backButton.png +0 -0
  54. data/doc/rdoc_iphone/iui/blueButton.png +0 -0
  55. data/doc/rdoc_iphone/iui/cancel.png +0 -0
  56. data/doc/rdoc_iphone/iui/grayButton.png +0 -0
  57. data/doc/rdoc_iphone/iui/iui-logo-touch-icon.png +0 -0
  58. data/doc/rdoc_iphone/iui/iui.css +0 -386
  59. data/doc/rdoc_iphone/iui/iui.js +0 -442
  60. data/doc/rdoc_iphone/iui/iuix.css +0 -1
  61. data/doc/rdoc_iphone/iui/iuix.js +0 -1
  62. data/doc/rdoc_iphone/iui/listArrow.png +0 -0
  63. data/doc/rdoc_iphone/iui/listArrowSel.png +0 -0
  64. data/doc/rdoc_iphone/iui/listGroup.png +0 -0
  65. data/doc/rdoc_iphone/iui/loading.gif +0 -0
  66. data/doc/rdoc_iphone/iui/pinstripes.png +0 -0
  67. data/doc/rdoc_iphone/iui/selection.png +0 -0
  68. data/doc/rdoc_iphone/iui/thumb.png +0 -0
  69. data/doc/rdoc_iphone/iui/toggle.png +0 -0
  70. data/doc/rdoc_iphone/iui/toggleOn.png +0 -0
  71. data/doc/rdoc_iphone/iui/toolButton.png +0 -0
  72. data/doc/rdoc_iphone/iui/toolbar.png +0 -0
  73. data/doc/rdoc_iphone/iui/whiteButton.png +0 -0
  74. data/doc/rdoc_iphone/rdoc-style.css +0 -0
@@ -1,129 +0,0 @@
1
-
2
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
3
- <html>
4
- <head>
5
- <title>
6
- Capcode, the Documentation &raquo; Class: Capcode::HTTPError
7
- </title>
8
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
9
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
10
- <script language="JavaScript" type="text/javascript">
11
- // <![CDATA[
12
-
13
- function toggleSource( id )
14
- {
15
- var elem
16
- var link
17
-
18
- if( document.getElementById )
19
- {
20
- elem = document.getElementById( id )
21
- link = document.getElementById( "l_" + id )
22
- }
23
- else if ( document.all )
24
- {
25
- elem = eval( "document.all." + id )
26
- link = eval( "document.all.l_" + id )
27
- }
28
- else
29
- return false;
30
-
31
- if( elem.style.display == "block" )
32
- {
33
- elem.style.display = "none"
34
- link.innerHTML = "show source"
35
- }
36
- else
37
- {
38
- elem.style.display = "block"
39
- link.innerHTML = "hide source"
40
- }
41
- }
42
-
43
- function openCode( url )
44
- {
45
- window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" )
46
- }
47
- // ]]>
48
- </script>
49
- </head>
50
- <body>
51
- <!--
52
- <div id="menu">
53
- <h3 class="title">Class: Capcode::HTTPError</h3>
54
- </div>
55
- -->
56
- <div id="fullpage">
57
- <div id="pager">
58
- <table>
59
- <tr><td><img src="../../rubyfr.png" /></td>
60
- <td id="pagertd">
61
- <strong># Class: Capcode::HTTPError<br />
62
- [
63
- "<a href="../../files/README.html" value="File: README">README</a>",
64
- "<a href="../../files/AUTHORS.html" value="File: AUTHORS">AUTHORS</a>",
65
- "<a href="../../files/COPYING.html" value="File: COPYING">COPYING</a>",
66
- "<a href="../../files/lib/capcode_rb.html" value="File: capcode.rb">lib/capcode.rb</a>",
67
- <a href="http://greg.rubyfr.net">nil</a>].each do<br />
68
- <a href="../../classes/Capcode.html" title="Module: Capcode">Capcode</a>.view_html<br />
69
- <a href="../../classes/Capcode/Views.html" title="Module: Capcode::Views">Capcode::Views</a>.view_html<br />
70
- <a href="../../classes/Capcode/Helpers.html" title="Module: Capcode::Helpers">Capcode::Helpers</a>.view_html<br />
71
- <a href="../../classes/Capcode/HTTPError.html" title="Class: Capcode::HTTPError">Capcode::HTTPError</a>.view_html<br />
72
- <a href="../../classes/Capcode/RenderError.html" title="Class: Capcode::RenderError">Capcode::RenderError</a>.view_html<br />
73
- <a href="../../classes/Capcode/RouteError.html" title="Class: Capcode::RouteError">Capcode::RouteError</a>.view_html<br />
74
- <a href="../../classes/Capcode/ParameterError.html" title="Class: Capcode::ParameterError">Capcode::ParameterError</a>.view_html<br />
75
- end</strong>
76
- </td></tr>
77
- </table>
78
- </ul>
79
- </div>
80
-
81
-
82
- <div id="Capcode::HTTPError" class="page_shade">
83
- <div class="page">
84
- <h3>Class Capcode::HTTPError &lt; Object</h3>
85
-
86
- (in files
87
- <a href="../../files/lib/capcode_rb.html">lib/capcode.rb</a>
88
- )
89
-
90
- <p>
91
- <a href="HTTPError.html">HTTPError</a> help you to create your own 404, 500
92
- and/or 501 response
93
- </p>
94
- <p>
95
- To create a custom 404 reponse, create a fonction HTTPError.r404 in your
96
- application :
97
- </p>
98
- <pre>
99
- module Capcode
100
- class HTTPError
101
- def r404(f)
102
- &quot;#{f} not found :(&quot;
103
- end
104
- end
105
- end
106
- </pre>
107
- <p>
108
- Do the same (r500, r501, r403) to customize 500, 501, 403 errors
109
- </p>
110
-
111
-
112
-
113
-
114
- <h4>Includes</h4>
115
- <ul>
116
- <li>Rack</li>
117
- <li><a href="Capcode/Helpers.html">Capcode::Helpers</a></li>
118
- <li><a href="Capcode/Views.html">Capcode::Views</a></li>
119
- </ul>
120
-
121
-
122
-
123
- </div>
124
- </div>
125
-
126
-
127
- </div>
128
- </body>
129
- </html>
@@ -1,342 +0,0 @@
1
-
2
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
3
- <html>
4
- <head>
5
- <title>
6
- Capcode, the Documentation &raquo; Module: Capcode::Helpers
7
- </title>
8
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
9
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
10
- <script language="JavaScript" type="text/javascript">
11
- // <![CDATA[
12
-
13
- function toggleSource( id )
14
- {
15
- var elem
16
- var link
17
-
18
- if( document.getElementById )
19
- {
20
- elem = document.getElementById( id )
21
- link = document.getElementById( "l_" + id )
22
- }
23
- else if ( document.all )
24
- {
25
- elem = eval( "document.all." + id )
26
- link = eval( "document.all.l_" + id )
27
- }
28
- else
29
- return false;
30
-
31
- if( elem.style.display == "block" )
32
- {
33
- elem.style.display = "none"
34
- link.innerHTML = "show source"
35
- }
36
- else
37
- {
38
- elem.style.display = "block"
39
- link.innerHTML = "hide source"
40
- }
41
- }
42
-
43
- function openCode( url )
44
- {
45
- window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" )
46
- }
47
- // ]]>
48
- </script>
49
- </head>
50
- <body>
51
- <!--
52
- <div id="menu">
53
- <h3 class="title">Module: Capcode::Helpers</h3>
54
- </div>
55
- -->
56
- <div id="fullpage">
57
- <div id="pager">
58
- <table>
59
- <tr><td><img src="../../rubyfr.png" /></td>
60
- <td id="pagertd">
61
- <strong># Module: Capcode::Helpers<br />
62
- [
63
- "<a href="../../files/README.html" value="File: README">README</a>",
64
- "<a href="../../files/AUTHORS.html" value="File: AUTHORS">AUTHORS</a>",
65
- "<a href="../../files/COPYING.html" value="File: COPYING">COPYING</a>",
66
- "<a href="../../files/lib/capcode_rb.html" value="File: capcode.rb">lib/capcode.rb</a>",
67
- <a href="http://greg.rubyfr.net">nil</a>].each do<br />
68
- <a href="../../classes/Capcode.html" title="Module: Capcode">Capcode</a>.view_html<br />
69
- <a href="../../classes/Capcode/Views.html" title="Module: Capcode::Views">Capcode::Views</a>.view_html<br />
70
- <a href="../../classes/Capcode/Helpers.html" title="Module: Capcode::Helpers">Capcode::Helpers</a>.view_html<br />
71
- <a href="../../classes/Capcode/HTTPError.html" title="Class: Capcode::HTTPError">Capcode::HTTPError</a>.view_html<br />
72
- <a href="../../classes/Capcode/RenderError.html" title="Class: Capcode::RenderError">Capcode::RenderError</a>.view_html<br />
73
- <a href="../../classes/Capcode/RouteError.html" title="Class: Capcode::RouteError">Capcode::RouteError</a>.view_html<br />
74
- <a href="../../classes/Capcode/ParameterError.html" title="Class: Capcode::ParameterError">Capcode::ParameterError</a>.view_html<br />
75
- end</strong>
76
- </td></tr>
77
- </table>
78
- </ul>
79
- </div>
80
-
81
-
82
- <div id="Capcode::Helpers" class="page_shade">
83
- <div class="page">
84
- <h3>Module Capcode::Helpers</h3>
85
-
86
- (in files
87
- <a href="../../files/lib/capcode_rb.html">lib/capcode.rb</a>
88
- )
89
-
90
- <p>
91
- <a href="Helpers.html">Helpers</a> contains methods available in your
92
- controllers
93
- </p>
94
-
95
-
96
-
97
-
98
- <h4>Includes</h4>
99
- <ul>
100
- <li>Rack</li>
101
- <li><a href="Capcode/Helpers.html">Capcode::Helpers</a></li>
102
- <li><a href="Capcode/Views.html">Capcode::Views</a></li>
103
- </ul>
104
-
105
- <h2 class="ruled">Methods</h2>
106
- <h4 class="ruled">Public Instance method:
107
- <strong><a name="M000012">URL( klass, *a )</a></strong> <a href="#M000012"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: URL" /></a></h4>
108
-
109
- <p>
110
- Builds an <a href="Helpers.html#M000012">URL</a> route to a controller or a
111
- path
112
- </p>
113
- <p>
114
- if you declare the controller Hello :
115
- </p>
116
- <pre>
117
- module Capcode
118
- class Hello &lt; Route '/hello/(.*)'
119
- ...
120
- end
121
- end
122
- </pre>
123
- <p>
124
- then
125
- </p>
126
- <pre>
127
- URL( Hello, &quot;you&quot; ) # =&gt; /hello/you
128
- </pre>
129
-
130
- <div class="sourcecode">
131
- <p class="source-link">[ <a href="javascript:toggleSource('M000012_source')" id="l_M000012_source">show source</a> ]</p>
132
- <div id="M000012_source" class="dyn-source">
133
- <pre>
134
- <span class="ruby-comment cmt"># File lib/capcode.rb, line 126</span>
135
- 126: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">URL</span>( <span class="ruby-identifier">klass</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">a</span> )
136
- 127: <span class="ruby-identifier">path</span> = <span class="ruby-keyword kw">nil</span>
137
- 128: <span class="ruby-identifier">a</span> = <span class="ruby-identifier">a</span>.<span class="ruby-identifier">delete_if</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">nil?</span> }
138
- 129:
139
- 130: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Class</span>
140
- 131: <span class="ruby-constant">Capcode</span>.<span class="ruby-identifier">routes</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span>, <span class="ruby-identifier">k</span><span class="ruby-operator">|</span>
141
- 132: <span class="ruby-identifier">path</span> = <span class="ruby-identifier">p</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">k</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">klass</span>
142
- 133: <span class="ruby-keyword kw">end</span>
143
- 134: <span class="ruby-keyword kw">else</span>
144
- 135: <span class="ruby-identifier">path</span> = <span class="ruby-identifier">klass</span>
145
- 136: <span class="ruby-keyword kw">end</span>
146
- 137:
147
- 138: <span class="ruby-identifier">path</span><span class="ruby-operator">+</span>((<span class="ruby-identifier">a</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">&gt;</span><span class="ruby-value">0</span>)<span class="ruby-operator">?</span>(<span class="ruby-value str">&quot;/&quot;</span><span class="ruby-operator">+</span><span class="ruby-identifier">a</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;/&quot;</span>))<span class="ruby-operator">:</span>(<span class="ruby-value str">&quot;&quot;</span>))
148
- 139: <span class="ruby-keyword kw">end</span>
149
- </pre>
150
- </div>
151
- </div>
152
- <h4 class="ruled">Public Instance method:
153
- <strong><a name="M000013">content_for( x ) {|| ...}</a></strong> <a href="#M000013"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: content_for" /></a></h4>
154
-
155
- <p>
156
- Calling <a href="Helpers.html#M000013">content_for</a> stores a block of
157
- markup in an identifier.
158
- </p>
159
-
160
- <div class="sourcecode">
161
- <p class="source-link">[ <a href="javascript:toggleSource('M000013_source')" id="l_M000013_source">show source</a> ]</p>
162
- <div id="M000013_source" class="dyn-source">
163
- <pre>
164
- <span class="ruby-comment cmt"># File lib/capcode.rb, line 142</span>
165
- 142: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content_for</span>( <span class="ruby-identifier">x</span> )
166
- 143: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@@__ARGS__</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">_</span><span class="ruby-operator">|</span> <span class="ruby-identifier">_</span>.<span class="ruby-identifier">to_s</span> }.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">x</span>.<span class="ruby-identifier">to_s</span>)
167
- 144: <span class="ruby-keyword kw">yield</span>
168
- 145: <span class="ruby-keyword kw">end</span>
169
- 146: <span class="ruby-keyword kw">end</span>
170
- </pre>
171
- </div>
172
- </div>
173
- <h4 class="ruled">Public Instance method:
174
- <strong><a name="M000010">json( d )</a></strong> <a href="#M000010"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: json" /></a></h4>
175
-
176
- <p>
177
- Help you to return a JSON response
178
- </p>
179
- <pre>
180
- module Capcode
181
- class JsonResponse &lt; Route '/json/([^\/]*)/(.*)'
182
- def get( arg1, arg2 )
183
- json( { :1 =&gt; arg1, :2 =&gt; arg2 })
184
- end
185
- end
186
- end
187
- </pre>
188
-
189
- <div class="sourcecode">
190
- <p class="source-link">[ <a href="javascript:toggleSource('M000010_source')" id="l_M000010_source">show source</a> ]</p>
191
- <div id="M000010_source" class="dyn-source">
192
- <pre>
193
- <span class="ruby-comment cmt"># File lib/capcode.rb, line 90</span>
194
- 90: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">json</span>( <span class="ruby-identifier">d</span> ) <span class="ruby-comment cmt">## DELETE THIS IN 1.0.0</span>
195
- 91: <span class="ruby-identifier">warn</span>( <span class="ruby-value str">&quot;json is deprecated, please use `render( :json =&gt; ... )'&quot;</span> )
196
- 92: <span class="ruby-ivar">@response</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-value str">'application/json'</span>
197
- 93: <span class="ruby-identifier">d</span>.<span class="ruby-identifier">to_json</span>
198
- 94: <span class="ruby-keyword kw">end</span>
199
- </pre>
200
- </div>
201
- </div>
202
- <h4 class="ruled">Public Instance method:
203
- <strong><a name="M000011">redirect( klass, *a )</a></strong> <a href="#M000011"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: redirect" /></a></h4>
204
-
205
- <p>
206
- Send a <a href="Helpers.html#M000011">redirect</a> response
207
- </p>
208
- <pre>
209
- module Capcode
210
- class Hello &lt; Route '/hello/(.*)'
211
- def get( you )
212
- if you.nil?
213
- redirect( WhoAreYou )
214
- else
215
- ...
216
- end
217
- end
218
- end
219
- end
220
- </pre>
221
-
222
- <div class="sourcecode">
223
- <p class="source-link">[ <a href="javascript:toggleSource('M000011_source')" id="l_M000011_source">show source</a> ]</p>
224
- <div id="M000011_source" class="dyn-source">
225
- <pre>
226
- <span class="ruby-comment cmt"># File lib/capcode.rb, line 109</span>
227
- 109: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">redirect</span>( <span class="ruby-identifier">klass</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">a</span> )
228
- 110: [<span class="ruby-value">302</span>, {<span class="ruby-value str">'Location'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">URL</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">a</span>)}, <span class="ruby-value str">''</span>]
229
- 111: <span class="ruby-keyword kw">end</span>
230
- </pre>
231
- </div>
232
- </div>
233
- <h4 class="ruled">Public Instance method:
234
- <strong><a name="M000009">render( h )</a></strong> <a href="#M000009"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: render" /></a></h4>
235
-
236
- <p>
237
- Render a view
238
- </p>
239
- <p>
240
- <a href="Helpers.html#M000009">render</a>&#8216;s parameter can be a Hash
241
- or a string. Passing a string is equivalent to do
242
- </p>
243
- <pre>
244
- render( :text =&gt; string )
245
- </pre>
246
- <p>
247
- If you want to use a specific renderer, use one of this options :
248
- </p>
249
- <ul>
250
- <li>:markaby =&gt; :my_func : :my_func must be defined in <a
251
- href="Views.html">Capcode::Views</a>
252
-
253
- </li>
254
- <li>:erb =&gt; :my_erb_file : this suppose that&#8216;s my_erb_file.rhtml exist
255
- in erb_path
256
-
257
- </li>
258
- <li>:haml =&gt; :my_haml_file : this suppose that&#8216;s my_haml_file.rhtml
259
- exist in haml_path
260
-
261
- </li>
262
- <li>:text =&gt; &quot;my text&quot;
263
-
264
- </li>
265
- <li>:<a href="Helpers.html#M000010">json</a> =&gt; MyObject : this suppose
266
- that&#8216;s MyObject respond to .to_json
267
-
268
- </li>
269
- </ul>
270
- <p>
271
- If you want to use a specific layout, you can specify it with option
272
- </p>
273
- <pre>
274
- :layout
275
- </pre>
276
-
277
- <div class="sourcecode">
278
- <p class="source-link">[ <a href="javascript:toggleSource('M000009_source')" id="l_M000009_source">show source</a> ]</p>
279
- <div id="M000009_source" class="dyn-source">
280
- <pre>
281
- <span class="ruby-comment cmt"># File lib/capcode.rb, line 52</span>
282
- 52: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span>( <span class="ruby-identifier">h</span> )
283
- 53: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">h</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Hash</span>
284
- 54: <span class="ruby-identifier">render_type</span> = <span class="ruby-keyword kw">nil</span>
285
- 55:
286
- 56: <span class="ruby-identifier">h</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span>
287
- 57: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-node">&quot;render_#{k.to_s}&quot;</span>)
288
- 58: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">render_type</span>.<span class="ruby-identifier">nil?</span>
289
- 59: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">RenderError</span>, <span class="ruby-node">&quot;Can't use multiple renderer (`#{render_type}' and `#{k}') !&quot;</span>, <span class="ruby-identifier">caller</span>
290
- 60: <span class="ruby-keyword kw">end</span>
291
- 61: <span class="ruby-identifier">render_type</span> = <span class="ruby-identifier">k</span>
292
- 62: <span class="ruby-keyword kw">end</span>
293
- 63: <span class="ruby-keyword kw">end</span>
294
- 64:
295
- 65: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">render_type</span>.<span class="ruby-identifier">nil?</span>
296
- 66: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">RenderError</span>, <span class="ruby-value str">&quot;Renderer type not specified!&quot;</span>, <span class="ruby-identifier">caller</span>
297
- 67: <span class="ruby-keyword kw">end</span>
298
- 68:
299
- 69: <span class="ruby-identifier">render_name</span> = <span class="ruby-identifier">h</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">render_type</span>)
300
- 70:
301
- 71: <span class="ruby-keyword kw">begin</span>
302
- 72: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>( <span class="ruby-node">&quot;render_#{render_type.to_s}&quot;</span>, <span class="ruby-identifier">render_name</span>, <span class="ruby-identifier">h</span> )
303
- 73: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
304
- 74: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">RenderError</span>, <span class="ruby-node">&quot;Error rendering `#{render_type.to_s}' : #{e.message}&quot;</span>, <span class="ruby-identifier">caller</span>
305
- 75: <span class="ruby-keyword kw">end</span>
306
- 76: <span class="ruby-keyword kw">else</span>
307
- 77: <span class="ruby-identifier">render</span>( <span class="ruby-identifier">:text</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">h</span> )
308
- 78: <span class="ruby-keyword kw">end</span>
309
- 79: <span class="ruby-keyword kw">end</span>
310
- </pre>
311
- </div>
312
- </div>
313
- <h4 class="ruled">Public Instance method:
314
- <strong><a name="M000014">static()</a></strong> <a href="#M000014"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: static" /></a></h4>
315
-
316
- <p>
317
- Return information about the <a href="Helpers.html#M000014">static</a>
318
- directory
319
- </p>
320
-
321
- <div class="sourcecode">
322
- <p class="source-link">[ <a href="javascript:toggleSource('M000014_source')" id="l_M000014_source">show source</a> ]</p>
323
- <div id="M000014_source" class="dyn-source">
324
- <pre>
325
- <span class="ruby-comment cmt"># File lib/capcode.rb, line 149</span>
326
- 149: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">static</span>
327
- 150: {
328
- 151: <span class="ruby-identifier">:uri</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Capcode</span>.<span class="ruby-identifier">static</span>,
329
- 152: <span class="ruby-identifier">:path</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>( <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;.&quot;</span>, <span class="ruby-constant">Capcode</span>.<span class="ruby-identifier">static</span> ) )
330
- 153: }
331
- 154: <span class="ruby-keyword kw">end</span>
332
- </pre>
333
- </div>
334
- </div>
335
-
336
- </div>
337
- </div>
338
-
339
-
340
- </div>
341
- </body>
342
- </html>