renee 0.3.11 → 0.4.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +17 -0
- data/Gemfile-renee +8 -0
- data/Gemfile-renee-core +8 -0
- data/Gemfile-renee-render +9 -0
- data/Gemfile-renee-session +9 -0
- data/Gemfile-renee-url-generation +8 -0
- data/MIT-LICENSE.txt +7 -0
- data/README-renee-core.md +242 -0
- data/README-renee-render.md +38 -0
- data/README-renee-session.md +3 -0
- data/README-renee-url-generation.md +3 -0
- data/README.md +131 -6
- data/Rakefile +109 -9
- data/TODO.txt +45 -0
- data/config.ru +26 -0
- data/examples/blog/blog.rb +3 -1
- data/examples/blog/config.ru +24 -19
- data/examples/blog/views/edit.erb +10 -1
- data/examples/blog/views/show.erb +5 -0
- data/lib/renee.rb +11 -4
- data/lib/renee/core.rb +98 -0
- data/lib/renee/core/chaining.rb +66 -0
- data/lib/renee/core/env_accessors.rb +72 -0
- data/lib/renee/core/exceptions.rb +15 -0
- data/lib/renee/core/matcher.rb +61 -0
- data/lib/renee/core/plugins.rb +31 -0
- data/lib/renee/core/rack_interaction.rb +50 -0
- data/lib/renee/core/request_context.rb +56 -0
- data/lib/renee/core/responding.rb +112 -0
- data/lib/renee/core/response.rb +78 -0
- data/lib/renee/core/routing.rb +319 -0
- data/lib/renee/core/transform.rb +18 -0
- data/lib/renee/render.rb +221 -0
- data/lib/renee/session.rb +50 -0
- data/lib/renee/url_generation.rb +117 -0
- data/lib/renee/util.rb +7 -0
- data/lib/renee/version.rb +2 -4
- data/plan.txt +19 -0
- data/renee-core.gemspec +26 -0
- data/renee-render.gemspec +30 -0
- data/renee-session.gemspec +28 -0
- data/renee-url-generation.gemspec +24 -0
- data/renee.gemspec +5 -6
- data/site/MIT-LICENSE.txt +7 -0
- data/site/public/css/app.css +75 -0
- data/site/public/docs/renee-core/Renee.html +208 -0
- data/site/public/docs/renee-core/Renee/Core.html +366 -0
- data/site/public/docs/renee-core/Renee/Core/Chaining.html +192 -0
- data/site/public/docs/renee-core/Renee/Core/ClassMethods.html +725 -0
- data/site/public/docs/renee-core/Renee/Core/ClientError.html +317 -0
- data/site/public/docs/renee-core/Renee/Core/EnvAccessors.html +152 -0
- data/site/public/docs/renee-core/Renee/Core/EnvAccessors/ClassMethods.html +354 -0
- data/site/public/docs/renee-core/Renee/Core/Matcher.html +675 -0
- data/site/public/docs/renee-core/Renee/Core/Plugins.html +475 -0
- data/site/public/docs/renee-core/Renee/Core/RackInteraction.html +488 -0
- data/site/public/docs/renee-core/Renee/Core/RequestContext.html +511 -0
- data/site/public/docs/renee-core/Renee/Core/Responding.html +877 -0
- data/site/public/docs/renee-core/Renee/Core/Response.html +691 -0
- data/site/public/docs/renee-core/Renee/Core/Routing.html +1589 -0
- data/site/public/docs/renee-core/Renee/Core/Transform.html +249 -0
- data/site/public/docs/renee-core/Renee/Core/URLGeneration.html +597 -0
- data/site/public/docs/renee-core/_index.html +244 -0
- data/site/public/docs/renee-core/class_list.html +47 -0
- data/site/public/docs/renee-core/css/common.css +1 -0
- data/site/public/docs/renee-core/css/full_list.css +55 -0
- data/site/public/docs/renee-core/css/style.css +322 -0
- data/site/public/docs/renee-core/file.README-renee-core.html +341 -0
- data/site/public/docs/renee-core/file.README.html +212 -0
- data/site/public/docs/renee-core/file_list.html +49 -0
- data/site/public/docs/renee-core/frames.html +13 -0
- data/site/public/docs/renee-core/index.html +341 -0
- data/site/public/docs/renee-core/js/app.js +205 -0
- data/site/public/docs/renee-core/js/full_list.js +167 -0
- data/site/public/docs/renee-core/js/jquery.js +16 -0
- data/site/public/docs/renee-core/method_list.html +590 -0
- data/site/public/docs/renee-core/top-level-namespace.html +103 -0
- data/site/public/docs/renee-render/Renee.html +116 -0
- data/site/public/docs/renee-render/Renee/Core.html +346 -0
- data/site/public/docs/renee-render/Renee/Core/Chaining.html +125 -0
- data/site/public/docs/renee-render/Renee/Core/ClassMethods.html +620 -0
- data/site/public/docs/renee-render/Renee/Core/ClientError.html +317 -0
- data/site/public/docs/renee-render/Renee/Core/EnvAccessors.html +152 -0
- data/site/public/docs/renee-render/Renee/Core/EnvAccessors/ClassMethods.html +354 -0
- data/site/public/docs/renee-render/Renee/Core/Matcher.html +675 -0
- data/site/public/docs/renee-render/Renee/Core/RackInteraction.html +488 -0
- data/site/public/docs/renee-render/Renee/Core/RequestContext.html +421 -0
- data/site/public/docs/renee-render/Renee/Core/Responding.html +873 -0
- data/site/public/docs/renee-render/Renee/Core/Response.html +691 -0
- data/site/public/docs/renee-render/Renee/Core/Routing.html +1682 -0
- data/site/public/docs/renee-render/Renee/Core/Transform.html +249 -0
- data/site/public/docs/renee-render/Renee/Core/URLGeneration.html +597 -0
- data/site/public/docs/renee-render/Renee/Render.html +873 -0
- data/site/public/docs/renee-render/Renee/Render/ClassMethods.html +382 -0
- data/site/public/docs/renee-render/Renee/Render/TemplateNotFound.html +126 -0
- data/site/public/docs/renee-render/_index.html +143 -0
- data/site/public/docs/renee-render/class_list.html +47 -0
- data/site/public/docs/renee-render/css/common.css +1 -0
- data/site/public/docs/renee-render/css/full_list.css +55 -0
- data/site/public/docs/renee-render/css/style.css +322 -0
- data/site/public/docs/renee-render/file.README-renee-render.html +104 -0
- data/site/public/docs/renee-render/file.README.html +212 -0
- data/site/public/docs/renee-render/file_list.html +49 -0
- data/site/public/docs/renee-render/frames.html +13 -0
- data/site/public/docs/renee-render/index.html +104 -0
- data/site/public/docs/renee-render/js/app.js +205 -0
- data/site/public/docs/renee-render/js/full_list.js +167 -0
- data/site/public/docs/renee-render/js/jquery.js +16 -0
- data/site/public/docs/renee-render/method_list.html +110 -0
- data/site/public/docs/renee-render/top-level-namespace.html +103 -0
- data/site/public/docs/renee-session/Renee.html +106 -0
- data/site/public/docs/renee-session/Renee/Session.html +173 -0
- data/site/public/docs/renee-session/Renee/Session/ClassMethods.html +470 -0
- data/site/public/docs/renee-session/_index.html +136 -0
- data/site/public/docs/renee-session/class_list.html +47 -0
- data/site/public/docs/renee-session/css/common.css +1 -0
- data/site/public/docs/renee-session/css/full_list.css +55 -0
- data/site/public/docs/renee-session/css/style.css +322 -0
- data/site/public/docs/renee-session/file.README-renee-core.html +341 -0
- data/site/public/docs/renee-session/file.README-renee-session.html +69 -0
- data/site/public/docs/renee-session/file_list.html +49 -0
- data/site/public/docs/renee-session/frames.html +13 -0
- data/site/public/docs/renee-session/index.html +69 -0
- data/site/public/docs/renee-session/js/app.js +205 -0
- data/site/public/docs/renee-session/js/full_list.js +167 -0
- data/site/public/docs/renee-session/js/jquery.js +16 -0
- data/site/public/docs/renee-session/method_list.html +102 -0
- data/site/public/docs/renee-session/top-level-namespace.html +103 -0
- data/site/public/docs/renee-url-generation/Renee.html +208 -0
- data/site/public/docs/renee-url-generation/Renee/Core.html +366 -0
- data/site/public/docs/renee-url-generation/Renee/Core/Chaining.html +192 -0
- data/site/public/docs/renee-url-generation/Renee/Core/ClassMethods.html +725 -0
- data/site/public/docs/renee-url-generation/Renee/Core/ClientError.html +317 -0
- data/site/public/docs/renee-url-generation/Renee/Core/EnvAccessors.html +152 -0
- data/site/public/docs/renee-url-generation/Renee/Core/EnvAccessors/ClassMethods.html +354 -0
- data/site/public/docs/renee-url-generation/Renee/Core/Matcher.html +675 -0
- data/site/public/docs/renee-url-generation/Renee/Core/Plugins.html +475 -0
- data/site/public/docs/renee-url-generation/Renee/Core/RackInteraction.html +488 -0
- data/site/public/docs/renee-url-generation/Renee/Core/RequestContext.html +511 -0
- data/site/public/docs/renee-url-generation/Renee/Core/Responding.html +877 -0
- data/site/public/docs/renee-url-generation/Renee/Core/Response.html +691 -0
- data/site/public/docs/renee-url-generation/Renee/Core/Routing.html +1589 -0
- data/site/public/docs/renee-url-generation/Renee/Core/Transform.html +249 -0
- data/site/public/docs/renee-url-generation/_index.html +244 -0
- data/site/public/docs/renee-url-generation/class_list.html +47 -0
- data/site/public/docs/renee-url-generation/css/common.css +1 -0
- data/site/public/docs/renee-url-generation/css/full_list.css +55 -0
- data/site/public/docs/renee-url-generation/css/style.css +322 -0
- data/site/public/docs/renee-url-generation/file.README-renee-url-generation.html +69 -0
- data/site/public/docs/renee-url-generation/file_list.html +49 -0
- data/site/public/docs/renee-url-generation/frames.html +13 -0
- data/site/public/docs/renee-url-generation/index.html +69 -0
- data/site/public/docs/renee-url-generation/js/app.js +205 -0
- data/site/public/docs/renee-url-generation/js/full_list.js +167 -0
- data/site/public/docs/renee-url-generation/js/jquery.js +16 -0
- data/site/public/docs/renee-url-generation/method_list.html +590 -0
- data/site/public/docs/renee-url-generation/top-level-namespace.html +103 -0
- data/site/public/docs/renee/Renee.html +232 -0
- data/site/public/docs/renee/Renee/Application.html +367 -0
- data/site/public/docs/renee/Renee/Core.html +370 -0
- data/site/public/docs/renee/Renee/Core/Chaining.html +192 -0
- data/site/public/docs/renee/Renee/Core/ClassMethods.html +725 -0
- data/site/public/docs/renee/Renee/Core/ClientError.html +317 -0
- data/site/public/docs/renee/Renee/Core/EnvAccessors.html +152 -0
- data/site/public/docs/renee/Renee/Core/EnvAccessors/ClassMethods.html +354 -0
- data/site/public/docs/renee/Renee/Core/Matcher.html +675 -0
- data/site/public/docs/renee/Renee/Core/Plugins.html +475 -0
- data/site/public/docs/renee/Renee/Core/RackInteraction.html +488 -0
- data/site/public/docs/renee/Renee/Core/RequestContext.html +511 -0
- data/site/public/docs/renee/Renee/Core/Responding.html +877 -0
- data/site/public/docs/renee/Renee/Core/Response.html +691 -0
- data/site/public/docs/renee/Renee/Core/Routing.html +1589 -0
- data/site/public/docs/renee/Renee/Core/Transform.html +249 -0
- data/site/public/docs/renee/Renee/Core/URLGeneration.html +597 -0
- data/site/public/docs/renee/Renee/Render.html +877 -0
- data/site/public/docs/renee/Renee/Render/ClassMethods.html +382 -0
- data/site/public/docs/renee/Renee/Render/TemplateNotFound.html +126 -0
- data/site/public/docs/renee/Renee/Session.html +177 -0
- data/site/public/docs/renee/Renee/Session/ClassMethods.html +470 -0
- data/site/public/docs/renee/Renee/URLGeneration.html +142 -0
- data/site/public/docs/renee/Renee/URLGeneration/ClassMethods.html +593 -0
- data/site/public/docs/renee/Renee/Util.html +163 -0
- data/site/public/docs/renee/_index.html +336 -0
- data/site/public/docs/renee/class_list.html +47 -0
- data/site/public/docs/renee/css/common.css +1 -0
- data/site/public/docs/renee/css/full_list.css +55 -0
- data/site/public/docs/renee/css/style.css +322 -0
- data/site/public/docs/renee/file.README.html +212 -0
- data/site/public/docs/renee/file_list.html +49 -0
- data/site/public/docs/renee/frames.html +13 -0
- data/site/public/docs/renee/index.html +212 -0
- data/site/public/docs/renee/js/app.js +205 -0
- data/site/public/docs/renee/js/full_list.js +167 -0
- data/site/public/docs/renee/js/jquery.js +16 -0
- data/site/public/docs/renee/method_list.html +758 -0
- data/site/public/docs/renee/top-level-namespace.html +202 -0
- data/site/public/img/favicon.ico +0 -0
- data/site/public/img/reneeclean.png +0 -0
- data/site/public/img/russiangithub.png +0 -0
- data/site/public/img/stoneposter.png +0 -0
- data/site/public/img/vospit.jpeg +0 -0
- data/site/views/chaining.md +32 -0
- data/site/views/index.md +219 -0
- data/site/views/layouts/app.haml +16 -0
- data/site/views/rack-integration.md +51 -0
- data/site/views/responding.md +103 -0
- data/site/views/route-generation.md +82 -0
- data/site/views/routing.md +261 -0
- data/site/views/settings.md +19 -0
- data/site/views/team-renee.md +13 -0
- data/site/views/tutorial.md +57 -0
- data/site/views/variable-types.md +57 -0
- data/test.watchr +61 -0
- data/test/renee-core/chaining_test.rb +33 -0
- data/test/renee-core/env_accessors_test.rb +43 -0
- data/test/renee-core/include_test.rb +14 -0
- data/test/renee-core/request_context_test.rb +70 -0
- data/test/renee-core/responding_test.rb +128 -0
- data/test/renee-core/routing_test.rb +443 -0
- data/test/renee-core/test_helper.rb +4 -0
- data/test/renee-core/variable_type_test.rb +57 -0
- data/test/renee-render/render_test.rb +162 -0
- data/test/renee-render/test_helper.rb +9 -0
- data/test/renee-session/session_test.rb +31 -0
- data/test/renee-session/test_helper.rb +9 -0
- data/test/renee-url-generation/test_helper.rb +10 -0
- data/test/renee-url-generation/url_generation_test.rb +63 -0
- data/test/{blog_test.rb → renee/blog_test.rb} +10 -5
- data/test/renee/test_helper.rb +56 -0
- data/test/test_helper.rb +23 -10
- metadata +333 -156
- data/.yardopts +0 -6
@@ -0,0 +1,877 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: Renee::Render
|
8
|
+
|
9
|
+
— Documentation by YARD 0.7.4
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '..';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="../_index.html">Index (R)</a> »
|
37
|
+
<span class='title'><span class='object_link'><a href="../Renee.html" title="Renee (module)">Renee</a></span></span>
|
38
|
+
»
|
39
|
+
<span class="title">Render</span>
|
40
|
+
|
41
|
+
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div id="search">
|
46
|
+
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
48
|
+
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
50
|
+
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<div class="clear"></div>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<iframe id="search_frame"></iframe>
|
58
|
+
|
59
|
+
<div id="content"><h1>Module: Renee::Render
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<dt class="r1">Included in:</dt>
|
74
|
+
<dd class="r1"><span class='object_link'><a href="Application.html" title="Renee::Application (class)">Application</a></span></dd>
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
<dt class="r2 last">Defined in:</dt>
|
79
|
+
<dd class="r2 last">lib/renee/render.rb</dd>
|
80
|
+
|
81
|
+
</dl>
|
82
|
+
<div class="clear"></div>
|
83
|
+
|
84
|
+
<h2>Overview</h2><div class="docstring">
|
85
|
+
<div class="discussion">
|
86
|
+
<p>This module is responsible for handling the rendering of templates
|
87
|
+
using Tilt supporting all included template engines.</p>
|
88
|
+
|
89
|
+
|
90
|
+
</div>
|
91
|
+
</div>
|
92
|
+
<div class="tags">
|
93
|
+
|
94
|
+
|
95
|
+
</div><h2>Defined Under Namespace</h2>
|
96
|
+
<p class="children">
|
97
|
+
|
98
|
+
|
99
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Render/ClassMethods.html" title="Renee::Render::ClassMethods (module)">ClassMethods</a></span>
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Render/TemplateNotFound.html" title="Renee::Render::TemplateNotFound (class)">TemplateNotFound</a></span>
|
104
|
+
|
105
|
+
|
106
|
+
</p>
|
107
|
+
|
108
|
+
<h2>Constant Summary</h2>
|
109
|
+
|
110
|
+
<dl class="constants">
|
111
|
+
|
112
|
+
<dt id="VERSION-constant" class="">VERSION =
|
113
|
+
<div class="docstring">
|
114
|
+
<div class="discussion">
|
115
|
+
<p>Current version of Renee::Render</p>
|
116
|
+
|
117
|
+
|
118
|
+
</div>
|
119
|
+
</div>
|
120
|
+
<div class="tags">
|
121
|
+
|
122
|
+
|
123
|
+
</div>
|
124
|
+
</dt>
|
125
|
+
<dd><pre class="code"><span class='const'>Renee</span><span class='op'>::</span><span class='const'>VERSION</span></pre></dd>
|
126
|
+
|
127
|
+
</dl>
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
<h2>
|
136
|
+
Instance Method Summary
|
137
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
138
|
+
</h2>
|
139
|
+
|
140
|
+
<ul class="summary">
|
141
|
+
|
142
|
+
<li class="public ">
|
143
|
+
<span class="summary_signature">
|
144
|
+
|
145
|
+
<a href="#inline-instance_method" title="#inline (instance method)">- (String) <strong>inline</strong>(data, engine, options = nil, &block) </a>
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
</span>
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
<span class="summary_desc"><div class='inline'><p>Renders a string given the engine and the content.</p>
|
159
|
+
</div></span>
|
160
|
+
|
161
|
+
</li>
|
162
|
+
|
163
|
+
|
164
|
+
<li class="public ">
|
165
|
+
<span class="summary_signature">
|
166
|
+
|
167
|
+
<a href="#inline%21-instance_method" title="#inline! (instance method)">- (String) <strong>inline!</strong>(data, engine, options = {}, &blk) </a>
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
</span>
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
<span class="summary_desc"><div class='inline'><p>Same as inline but automatically halts.</p>
|
181
|
+
</div></span>
|
182
|
+
|
183
|
+
</li>
|
184
|
+
|
185
|
+
|
186
|
+
<li class="public ">
|
187
|
+
<span class="summary_signature">
|
188
|
+
|
189
|
+
<a href="#partial-instance_method" title="#partial (instance method)">- (String) <strong>partial</strong>(template, options = {}) </a>
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
</span>
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
<span class="summary_desc"><div class='inline'><p>Render a partials with collections support.</p>
|
203
|
+
</div></span>
|
204
|
+
|
205
|
+
</li>
|
206
|
+
|
207
|
+
|
208
|
+
<li class="public ">
|
209
|
+
<span class="summary_signature">
|
210
|
+
|
211
|
+
<a href="#render-instance_method" title="#render (instance method)">- (String) <strong>render</strong>(file, engine = nil, options = nil, &block) </a>
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
</span>
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
<span class="summary_desc"><div class='inline'><p>Renders a file given the engine and the content.</p>
|
225
|
+
</div></span>
|
226
|
+
|
227
|
+
</li>
|
228
|
+
|
229
|
+
|
230
|
+
<li class="public ">
|
231
|
+
<span class="summary_signature">
|
232
|
+
|
233
|
+
<a href="#render%21-instance_method" title="#render! (instance method)">- (String) <strong>render!</strong>(file, engine = nil, options = nil, &blk) </a>
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
</span>
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
<span class="summary_desc"><div class='inline'><p>Same as render but automatically halts.</p>
|
247
|
+
</div></span>
|
248
|
+
|
249
|
+
</li>
|
250
|
+
|
251
|
+
|
252
|
+
</ul>
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
<div id="instance_method_details" class="method_details_list">
|
258
|
+
<h2>Instance Method Details</h2>
|
259
|
+
|
260
|
+
|
261
|
+
<div class="method_details first">
|
262
|
+
<p class="signature first" id="inline-instance_method">
|
263
|
+
|
264
|
+
- (<tt>String</tt>) <strong>inline</strong>(data, engine, options = nil, &block)
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
</p><div class="docstring">
|
269
|
+
<div class="discussion">
|
270
|
+
<p>Renders a string given the engine and the content.</p>
|
271
|
+
|
272
|
+
<p>it will be detected based on the extension of the file.</p>
|
273
|
+
|
274
|
+
|
275
|
+
</div>
|
276
|
+
</div>
|
277
|
+
<div class="tags">
|
278
|
+
|
279
|
+
<div class="examples">
|
280
|
+
<h3>Examples:</h3>
|
281
|
+
|
282
|
+
<h4><div class='inline'>
|
283
|
+
</div></h4>
|
284
|
+
<pre class="example code"><span class='id identifier rubyid_inline'>inline</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%p test</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='symbol'>:haml</span> <span class='comment'># => "<p>test</p>"</span></pre>
|
285
|
+
|
286
|
+
</div>
|
287
|
+
<h3>Parameters:</h3>
|
288
|
+
<ul class="param">
|
289
|
+
|
290
|
+
<li>
|
291
|
+
|
292
|
+
<span class='name'>data</span>
|
293
|
+
|
294
|
+
|
295
|
+
<span class='type'>(<tt>String</tt>)</span>
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
—
|
300
|
+
<div class='inline'><p>The string data to render.</p>
|
301
|
+
</div>
|
302
|
+
|
303
|
+
</li>
|
304
|
+
|
305
|
+
<li>
|
306
|
+
|
307
|
+
<span class='name'>engine</span>
|
308
|
+
|
309
|
+
|
310
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
—
|
315
|
+
<div class='inline'><p>The name of the engine to use to render the content. If this isn't specified</p>
|
316
|
+
</div>
|
317
|
+
|
318
|
+
</li>
|
319
|
+
|
320
|
+
<li>
|
321
|
+
|
322
|
+
<span class='name'>options</span>
|
323
|
+
|
324
|
+
|
325
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
326
|
+
|
327
|
+
|
328
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
329
|
+
|
330
|
+
|
331
|
+
—
|
332
|
+
<div class='inline'><p>The options to pass in for rendering.</p>
|
333
|
+
</div>
|
334
|
+
|
335
|
+
</li>
|
336
|
+
|
337
|
+
</ul>
|
338
|
+
|
339
|
+
<h3>Returns:</h3>
|
340
|
+
<ul class="return">
|
341
|
+
|
342
|
+
<li>
|
343
|
+
|
344
|
+
|
345
|
+
<span class='type'>(<tt>String</tt>)</span>
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
—
|
350
|
+
<div class='inline'><p>The result of rendering the data with specified engine.</p>
|
351
|
+
</div>
|
352
|
+
|
353
|
+
</li>
|
354
|
+
|
355
|
+
</ul>
|
356
|
+
|
357
|
+
</div><table class="source_code">
|
358
|
+
<tr>
|
359
|
+
<td>
|
360
|
+
<pre class="lines">
|
361
|
+
|
362
|
+
|
363
|
+
119
|
364
|
+
120
|
365
|
+
121
|
366
|
+
122
|
367
|
+
123
|
368
|
+
124
|
369
|
+
125
|
370
|
+
126
|
371
|
+
127
|
372
|
+
128</pre>
|
373
|
+
</td>
|
374
|
+
<td>
|
375
|
+
<pre class="code"><span class="info file"># File 'lib/renee/render.rb', line 119</span>
|
376
|
+
|
377
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_inline'>inline</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_engine'>engine</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
378
|
+
<span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='id identifier rubyid_engine'>engine</span> <span class='op'>=</span> <span class='id identifier rubyid_engine'>engine</span><span class='comma'>,</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_engine'>engine</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span>
|
379
|
+
<span class='id identifier rubyid_call_data'>call_data</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>&&</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:_caller</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='const'>Callsite</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_caller'>caller</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='rparen'>)</span>
|
380
|
+
<span class='id identifier rubyid_render_setup'>render_setup</span><span class='lparen'>(</span><span class='id identifier rubyid_engine'>engine</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_view_options'>view_options</span><span class='comma'>,</span> <span class='id identifier rubyid_views'>views</span><span class='op'>|</span>
|
381
|
+
<span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Proc</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_data'>data</span> <span class='op'>:</span> <span class='const'>Proc</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_data'>data</span> <span class='rbrace'>}</span>
|
382
|
+
<span class='id identifier rubyid_template'>template</span> <span class='op'>=</span> <span class='const'>Tilt</span><span class='lbracket'>[</span><span class='id identifier rubyid_engine'>engine</span><span class='rbracket'>]</span>
|
383
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Template engine not found: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_engine'>engine</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_template'>template</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
384
|
+
<span class='id identifier rubyid_template'>template</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_call_data'>call_data</span><span class='period'>.</span><span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_call_data'>call_data</span><span class='period'>.</span><span class='id identifier rubyid_line'>line</span><span class='comma'>,</span> <span class='id identifier rubyid_view_options'>view_options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
|
385
|
+
<span class='kw'>end</span>
|
386
|
+
<span class='kw'>end</span></pre>
|
387
|
+
</td>
|
388
|
+
</tr>
|
389
|
+
</table>
|
390
|
+
</div>
|
391
|
+
|
392
|
+
<div class="method_details ">
|
393
|
+
<p class="signature " id="inline!-instance_method">
|
394
|
+
|
395
|
+
- (<tt>String</tt>) <strong>inline!</strong>(data, engine, options = {}, &blk)
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
</p><div class="docstring">
|
400
|
+
<div class="discussion">
|
401
|
+
<p>Same as inline but automatically halts.</p>
|
402
|
+
|
403
|
+
|
404
|
+
</div>
|
405
|
+
</div>
|
406
|
+
<div class="tags">
|
407
|
+
<h3>Parameters:</h3>
|
408
|
+
<ul class="param">
|
409
|
+
|
410
|
+
<li>
|
411
|
+
|
412
|
+
<span class='name'>data</span>
|
413
|
+
|
414
|
+
|
415
|
+
<span class='type'>(<tt>String</tt>)</span>
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
—
|
420
|
+
<div class='inline'><p>The string data to render.</p>
|
421
|
+
</div>
|
422
|
+
|
423
|
+
</li>
|
424
|
+
|
425
|
+
<li>
|
426
|
+
|
427
|
+
<span class='name'>engine</span>
|
428
|
+
|
429
|
+
|
430
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
—
|
435
|
+
<div class='inline'><p>The name of the engine to use to render the content. If this isn't specified</p>
|
436
|
+
</div>
|
437
|
+
|
438
|
+
</li>
|
439
|
+
|
440
|
+
<li>
|
441
|
+
|
442
|
+
<span class='name'>options</span>
|
443
|
+
|
444
|
+
|
445
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
446
|
+
|
447
|
+
|
448
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
449
|
+
|
450
|
+
|
451
|
+
—
|
452
|
+
<div class='inline'><p>The options to pass in for rendering.</p>
|
453
|
+
</div>
|
454
|
+
|
455
|
+
</li>
|
456
|
+
|
457
|
+
</ul>
|
458
|
+
|
459
|
+
<h3>Returns:</h3>
|
460
|
+
<ul class="return">
|
461
|
+
|
462
|
+
<li>
|
463
|
+
|
464
|
+
|
465
|
+
<span class='type'>(<tt>String</tt>)</span>
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
—
|
470
|
+
<div class='inline'><p>The result of rendering the data with specified engine.</p>
|
471
|
+
</div>
|
472
|
+
|
473
|
+
</li>
|
474
|
+
|
475
|
+
</ul>
|
476
|
+
|
477
|
+
<h3>See Also:</h3>
|
478
|
+
<ul class="see">
|
479
|
+
|
480
|
+
<li><span class='object_link'><a href="#inline-instance_method" title="Renee::Render#inline (method)">#inline</a></span></li>
|
481
|
+
|
482
|
+
</ul>
|
483
|
+
|
484
|
+
</div><table class="source_code">
|
485
|
+
<tr>
|
486
|
+
<td>
|
487
|
+
<pre class="lines">
|
488
|
+
|
489
|
+
|
490
|
+
69
|
491
|
+
70
|
492
|
+
71
|
493
|
+
72</pre>
|
494
|
+
</td>
|
495
|
+
<td>
|
496
|
+
<pre class="code"><span class="info file"># File 'lib/renee/render.rb', line 69</span>
|
497
|
+
|
498
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_inline!'>inline!</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_engine'>engine</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_blk'>blk</span><span class='rparen'>)</span>
|
499
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:_caller</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='const'>Callsite</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_caller'>caller</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='rparen'>)</span>
|
500
|
+
<span class='id identifier rubyid_halt'>halt</span> <span class='id identifier rubyid_inline'>inline</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_engine'>engine</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_blk'>blk</span><span class='rparen'>)</span>
|
501
|
+
<span class='kw'>end</span></pre>
|
502
|
+
</td>
|
503
|
+
</tr>
|
504
|
+
</table>
|
505
|
+
</div>
|
506
|
+
|
507
|
+
<div class="method_details ">
|
508
|
+
<p class="signature " id="partial-instance_method">
|
509
|
+
|
510
|
+
- (<tt>String</tt>) <strong>partial</strong>(template, options = {})
|
511
|
+
|
512
|
+
|
513
|
+
|
514
|
+
</p><div class="docstring">
|
515
|
+
<div class="discussion">
|
516
|
+
<p>Render a partials with collections support</p>
|
517
|
+
|
518
|
+
|
519
|
+
</div>
|
520
|
+
</div>
|
521
|
+
<div class="tags">
|
522
|
+
|
523
|
+
<div class="examples">
|
524
|
+
<h3>Examples:</h3>
|
525
|
+
|
526
|
+
<h4><div class='inline'>
|
527
|
+
</div></h4>
|
528
|
+
<pre class="example code"><span class='id identifier rubyid_partial'>partial</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>photo/item</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:object</span> <span class='op'>=></span> <span class='ivar'>@photo</span>
|
529
|
+
<span class='id identifier rubyid_partial'>partial</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>photo/item</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:collection</span> <span class='op'>=></span> <span class='ivar'>@photos</span>
|
530
|
+
<span class='id identifier rubyid_partial'>partial</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>photo/item</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:locals</span> <span class='op'>=></span> <span class='lbrace'>{</span> <span class='symbol'>:foo</span> <span class='op'>=></span> <span class='symbol'>:bar</span> <span class='rbrace'>}</span></pre>
|
531
|
+
|
532
|
+
</div>
|
533
|
+
|
534
|
+
<h3>Returns:</h3>
|
535
|
+
<ul class="return">
|
536
|
+
|
537
|
+
<li>
|
538
|
+
|
539
|
+
|
540
|
+
<span class='type'>(<tt>String</tt>)</span>
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
—
|
545
|
+
<div class='inline'><p>The html generated from this partial.</p>
|
546
|
+
</div>
|
547
|
+
|
548
|
+
</li>
|
549
|
+
|
550
|
+
</ul>
|
551
|
+
|
552
|
+
</div><table class="source_code">
|
553
|
+
<tr>
|
554
|
+
<td>
|
555
|
+
<pre class="lines">
|
556
|
+
|
557
|
+
|
558
|
+
140
|
559
|
+
141
|
560
|
+
142
|
561
|
+
143
|
562
|
+
144
|
563
|
+
145
|
564
|
+
146
|
565
|
+
147
|
566
|
+
148
|
567
|
+
149
|
568
|
+
150
|
569
|
+
151
|
570
|
+
152
|
571
|
+
153
|
572
|
+
154
|
573
|
+
155
|
574
|
+
156
|
575
|
+
157
|
576
|
+
158
|
577
|
+
159
|
578
|
+
160
|
579
|
+
161</pre>
|
580
|
+
</td>
|
581
|
+
<td>
|
582
|
+
<pre class="code"><span class="info file"># File 'lib/renee/render.rb', line 140</span>
|
583
|
+
|
584
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_partial'>partial</span><span class='lparen'>(</span><span class='id identifier rubyid_template'>template</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
585
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='symbol'>:locals</span> <span class='op'>=></span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='symbol'>:layout</span> <span class='op'>=></span> <span class='kw'>false</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
586
|
+
<span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='id identifier rubyid_template'>template</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='const'>File</span><span class='op'>::</span><span class='const'>SEPARATOR</span><span class='rparen'>)</span>
|
587
|
+
<span class='id identifier rubyid_object_name'>object_name</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span><span class='lbracket'>[</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
588
|
+
<span class='id identifier rubyid_path'>path</span><span class='lbracket'>[</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='lbracket'>[</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
589
|
+
<span class='id identifier rubyid_template_path'>template_path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
590
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Partial collection specified but is nil</span><span class='tstring_end'>'</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:collection</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:collection</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
591
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_collection'>collection</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:collection</span><span class='rparen'>)</span>
|
592
|
+
<span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:object</span><span class='rparen'>)</span>
|
593
|
+
<span class='id identifier rubyid_counter'>counter</span> <span class='op'>=</span> <span class='int'>0</span>
|
594
|
+
<span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_member'>member</span><span class='op'>|</span>
|
595
|
+
<span class='id identifier rubyid_counter'>counter</span> <span class='op'>+=</span> <span class='int'>1</span>
|
596
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locals</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_object_name'>object_name</span> <span class='op'>=></span> <span class='id identifier rubyid_member'>member</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_object_name'>object_name</span><span class='rbrace'>}</span><span class='tstring_content'>_counter</span><span class='tstring_end'>"</span></span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span> <span class='op'>=></span> <span class='id identifier rubyid_counter'>counter</span><span class='rparen'>)</span>
|
597
|
+
<span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='id identifier rubyid_template_path'>template_path</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span><span class='rparen'>)</span>
|
598
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
599
|
+
<span class='kw'>else</span>
|
600
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_member'>member</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:object</span><span class='rparen'>)</span>
|
601
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:locals</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_object_name'>object_name</span> <span class='op'>=></span> <span class='id identifier rubyid_member'>member</span><span class='rparen'>)</span>
|
602
|
+
<span class='kw'>end</span>
|
603
|
+
<span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='id identifier rubyid_template_path'>template_path</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span><span class='rparen'>)</span>
|
604
|
+
<span class='kw'>end</span>
|
605
|
+
<span class='kw'>end</span></pre>
|
606
|
+
</td>
|
607
|
+
</tr>
|
608
|
+
</table>
|
609
|
+
</div>
|
610
|
+
|
611
|
+
<div class="method_details ">
|
612
|
+
<p class="signature " id="render-instance_method">
|
613
|
+
|
614
|
+
- (<tt>String</tt>) <strong>render</strong>(file, engine = nil, options = nil, &block)
|
615
|
+
|
616
|
+
|
617
|
+
|
618
|
+
</p><div class="docstring">
|
619
|
+
<div class="discussion">
|
620
|
+
<p>Renders a file given the engine and the content.</p>
|
621
|
+
|
622
|
+
<p>it will be detected based on the extension of the file.</p>
|
623
|
+
|
624
|
+
|
625
|
+
</div>
|
626
|
+
</div>
|
627
|
+
<div class="tags">
|
628
|
+
|
629
|
+
<div class="examples">
|
630
|
+
<h3>Examples:</h3>
|
631
|
+
|
632
|
+
<h4><div class='inline'>
|
633
|
+
</div></h4>
|
634
|
+
<pre class="example code"><span class='id identifier rubyid_render'>render</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>index</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='symbol'>:haml</span> <span class='comment'># => "<p>test</p>"
|
635
|
+
</span><span class='id identifier rubyid_render'>render</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>index</span><span class='tstring_end'>"</span></span> <span class='comment'># => "<p>test</p>"</span></pre>
|
636
|
+
|
637
|
+
</div>
|
638
|
+
<h3>Parameters:</h3>
|
639
|
+
<ul class="param">
|
640
|
+
|
641
|
+
<li>
|
642
|
+
|
643
|
+
<span class='name'>file</span>
|
644
|
+
|
645
|
+
|
646
|
+
<span class='type'>(<tt>String</tt>)</span>
|
647
|
+
|
648
|
+
|
649
|
+
|
650
|
+
—
|
651
|
+
<div class='inline'><p>The path to the file to render</p>
|
652
|
+
</div>
|
653
|
+
|
654
|
+
</li>
|
655
|
+
|
656
|
+
<li>
|
657
|
+
|
658
|
+
<span class='name'>engine</span>
|
659
|
+
|
660
|
+
|
661
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
662
|
+
|
663
|
+
|
664
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
665
|
+
|
666
|
+
|
667
|
+
—
|
668
|
+
<div class='inline'><p>The name of the engine to use to render the content. If this isn't specified</p>
|
669
|
+
</div>
|
670
|
+
|
671
|
+
</li>
|
672
|
+
|
673
|
+
<li>
|
674
|
+
|
675
|
+
<span class='name'>options</span>
|
676
|
+
|
677
|
+
|
678
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
679
|
+
|
680
|
+
|
681
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
682
|
+
|
683
|
+
|
684
|
+
—
|
685
|
+
<div class='inline'><p>The options to pass in for rendering.</p>
|
686
|
+
</div>
|
687
|
+
|
688
|
+
</li>
|
689
|
+
|
690
|
+
</ul>
|
691
|
+
|
692
|
+
<h3>Returns:</h3>
|
693
|
+
<ul class="return">
|
694
|
+
|
695
|
+
<li>
|
696
|
+
|
697
|
+
|
698
|
+
<span class='type'>(<tt>String</tt>)</span>
|
699
|
+
|
700
|
+
|
701
|
+
|
702
|
+
—
|
703
|
+
<div class='inline'><p>The result of rendering the data with specified engine.</p>
|
704
|
+
</div>
|
705
|
+
|
706
|
+
</li>
|
707
|
+
|
708
|
+
</ul>
|
709
|
+
|
710
|
+
</div><table class="source_code">
|
711
|
+
<tr>
|
712
|
+
<td>
|
713
|
+
<pre class="lines">
|
714
|
+
|
715
|
+
|
716
|
+
90
|
717
|
+
91
|
718
|
+
92
|
719
|
+
93
|
720
|
+
94
|
721
|
+
95
|
722
|
+
96
|
723
|
+
97
|
724
|
+
98
|
725
|
+
99
|
726
|
+
100
|
727
|
+
101
|
728
|
+
102</pre>
|
729
|
+
</td>
|
730
|
+
<td>
|
731
|
+
<pre class="code"><span class="info file"># File 'lib/renee/render.rb', line 90</span>
|
732
|
+
|
733
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_engine'>engine</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
734
|
+
<span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='id identifier rubyid_engine'>engine</span> <span class='op'>=</span> <span class='id identifier rubyid_engine'>engine</span><span class='comma'>,</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_engine'>engine</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span>
|
735
|
+
<span class='id identifier rubyid_render_setup'>render_setup</span><span class='lparen'>(</span><span class='id identifier rubyid_engine'>engine</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_view_options'>view_options</span><span class='comma'>,</span> <span class='id identifier rubyid_views'>views</span><span class='op'>|</span>
|
736
|
+
<span class='id identifier rubyid_template_cache'>template_cache</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='id identifier rubyid_engine'>engine</span><span class='comma'>,</span> <span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_view_options'>view_options</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
737
|
+
<span class='id identifier rubyid_file_path'>file_path</span><span class='comma'>,</span> <span class='id identifier rubyid_found_engine'>found_engine</span> <span class='op'>=</span> <span class='id identifier rubyid_find_template'>find_template</span><span class='lparen'>(</span><span class='id identifier rubyid_views'>views</span><span class='comma'>,</span> <span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_engine'>engine</span><span class='rparen'>)</span>
|
738
|
+
<span class='id identifier rubyid_template'>template</span> <span class='op'>=</span> <span class='const'>Tilt</span><span class='lbracket'>[</span><span class='id identifier rubyid_found_engine'>found_engine</span><span class='rbracket'>]</span>
|
739
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>TemplateNotFound</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Template engine not found: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_found_engine'>found_engine</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_template'>template</span>
|
740
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>TemplateNotFound</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Template </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='rbrace'>}</span><span class='tstring_content'> (with engine </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_engine'>engine</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='rbrace'>}</span><span class='tstring_content'>) not found in </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_views'>views</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='rbrace'>}</span><span class='tstring_content'>!</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_file_path'>file_path</span>
|
741
|
+
<span class='comment'># TODO suppress errors for layouts?
|
742
|
+
</span> <span class='id identifier rubyid_template'>template</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='comma'>,</span> <span class='int'>1</span><span class='comma'>,</span> <span class='id identifier rubyid_view_options'>view_options</span><span class='rparen'>)</span>
|
743
|
+
<span class='kw'>end</span>
|
744
|
+
<span class='kw'>end</span>
|
745
|
+
<span class='kw'>end</span></pre>
|
746
|
+
</td>
|
747
|
+
</tr>
|
748
|
+
</table>
|
749
|
+
</div>
|
750
|
+
|
751
|
+
<div class="method_details ">
|
752
|
+
<p class="signature " id="render!-instance_method">
|
753
|
+
|
754
|
+
- (<tt>String</tt>) <strong>render!</strong>(file, engine = nil, options = nil, &blk)
|
755
|
+
|
756
|
+
|
757
|
+
|
758
|
+
</p><div class="docstring">
|
759
|
+
<div class="discussion">
|
760
|
+
<p>Same as render but automatically halts.</p>
|
761
|
+
|
762
|
+
|
763
|
+
</div>
|
764
|
+
</div>
|
765
|
+
<div class="tags">
|
766
|
+
<h3>Parameters:</h3>
|
767
|
+
<ul class="param">
|
768
|
+
|
769
|
+
<li>
|
770
|
+
|
771
|
+
<span class='name'>file</span>
|
772
|
+
|
773
|
+
|
774
|
+
<span class='type'>(<tt>String</tt>)</span>
|
775
|
+
|
776
|
+
|
777
|
+
|
778
|
+
—
|
779
|
+
<div class='inline'><p>The path to the file to render</p>
|
780
|
+
</div>
|
781
|
+
|
782
|
+
</li>
|
783
|
+
|
784
|
+
<li>
|
785
|
+
|
786
|
+
<span class='name'>engine</span>
|
787
|
+
|
788
|
+
|
789
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
790
|
+
|
791
|
+
|
792
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
793
|
+
|
794
|
+
|
795
|
+
—
|
796
|
+
<div class='inline'><p>The name of the engine to use to render the content. If this isn't specified</p>
|
797
|
+
</div>
|
798
|
+
|
799
|
+
</li>
|
800
|
+
|
801
|
+
<li>
|
802
|
+
|
803
|
+
<span class='name'>options</span>
|
804
|
+
|
805
|
+
|
806
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
807
|
+
|
808
|
+
|
809
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
810
|
+
|
811
|
+
|
812
|
+
—
|
813
|
+
<div class='inline'><p>The options to pass in for rendering.</p>
|
814
|
+
</div>
|
815
|
+
|
816
|
+
</li>
|
817
|
+
|
818
|
+
</ul>
|
819
|
+
|
820
|
+
<h3>Returns:</h3>
|
821
|
+
<ul class="return">
|
822
|
+
|
823
|
+
<li>
|
824
|
+
|
825
|
+
|
826
|
+
<span class='type'>(<tt>String</tt>)</span>
|
827
|
+
|
828
|
+
|
829
|
+
|
830
|
+
—
|
831
|
+
<div class='inline'><p>The result of rendering the data with specified engine.</p>
|
832
|
+
</div>
|
833
|
+
|
834
|
+
</li>
|
835
|
+
|
836
|
+
</ul>
|
837
|
+
|
838
|
+
<h3>See Also:</h3>
|
839
|
+
<ul class="see">
|
840
|
+
|
841
|
+
<li><span class='object_link'><a href="#render-instance_method" title="Renee::Render#render (method)">#render</a></span></li>
|
842
|
+
|
843
|
+
</ul>
|
844
|
+
|
845
|
+
</div><table class="source_code">
|
846
|
+
<tr>
|
847
|
+
<td>
|
848
|
+
<pre class="lines">
|
849
|
+
|
850
|
+
|
851
|
+
61
|
852
|
+
62
|
853
|
+
63</pre>
|
854
|
+
</td>
|
855
|
+
<td>
|
856
|
+
<pre class="code"><span class="info file"># File 'lib/renee/render.rb', line 61</span>
|
857
|
+
|
858
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_render!'>render!</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_engine'>engine</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_blk'>blk</span><span class='rparen'>)</span>
|
859
|
+
<span class='id identifier rubyid_halt'>halt</span> <span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_engine'>engine</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_blk'>blk</span><span class='rparen'>)</span>
|
860
|
+
<span class='kw'>end</span></pre>
|
861
|
+
</td>
|
862
|
+
</tr>
|
863
|
+
</table>
|
864
|
+
</div>
|
865
|
+
|
866
|
+
</div>
|
867
|
+
|
868
|
+
</div>
|
869
|
+
|
870
|
+
<div id="footer">
|
871
|
+
Generated on Mon Jan 23 11:10:34 2012 by
|
872
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
873
|
+
0.7.4 (ruby-1.9.2).
|
874
|
+
</div>
|
875
|
+
|
876
|
+
</body>
|
877
|
+
</html>
|