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,873 @@
|
|
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
|
+
|
74
|
+
<dt class="r1 last">Defined in:</dt>
|
75
|
+
<dd class="r1 last">lib/renee/render.rb</dd>
|
76
|
+
|
77
|
+
</dl>
|
78
|
+
<div class="clear"></div>
|
79
|
+
|
80
|
+
<h2>Overview</h2><div class="docstring">
|
81
|
+
<div class="discussion">
|
82
|
+
<p>This module is responsible for handling the rendering of templates
|
83
|
+
using Tilt supporting all included template engines.</p>
|
84
|
+
|
85
|
+
|
86
|
+
</div>
|
87
|
+
</div>
|
88
|
+
<div class="tags">
|
89
|
+
|
90
|
+
|
91
|
+
</div><h2>Defined Under Namespace</h2>
|
92
|
+
<p class="children">
|
93
|
+
|
94
|
+
|
95
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Render/ClassMethods.html" title="Renee::Render::ClassMethods (module)">ClassMethods</a></span>
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Render/TemplateNotFound.html" title="Renee::Render::TemplateNotFound (class)">TemplateNotFound</a></span>
|
100
|
+
|
101
|
+
|
102
|
+
</p>
|
103
|
+
|
104
|
+
<h2>Constant Summary</h2>
|
105
|
+
|
106
|
+
<dl class="constants">
|
107
|
+
|
108
|
+
<dt id="VERSION-constant" class="">VERSION =
|
109
|
+
<div class="docstring">
|
110
|
+
<div class="discussion">
|
111
|
+
<p>Current version of Renee::Render</p>
|
112
|
+
|
113
|
+
|
114
|
+
</div>
|
115
|
+
</div>
|
116
|
+
<div class="tags">
|
117
|
+
|
118
|
+
|
119
|
+
</div>
|
120
|
+
</dt>
|
121
|
+
<dd><pre class="code"><span class='const'>Renee</span><span class='op'>::</span><span class='const'>VERSION</span></pre></dd>
|
122
|
+
|
123
|
+
</dl>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
<h2>
|
132
|
+
Instance Method Summary
|
133
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
134
|
+
</h2>
|
135
|
+
|
136
|
+
<ul class="summary">
|
137
|
+
|
138
|
+
<li class="public ">
|
139
|
+
<span class="summary_signature">
|
140
|
+
|
141
|
+
<a href="#inline-instance_method" title="#inline (instance method)">- (String) <strong>inline</strong>(data, engine, options = nil, &block) </a>
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
</span>
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
<span class="summary_desc"><div class='inline'><p>Renders a string given the engine and the content.</p>
|
155
|
+
</div></span>
|
156
|
+
|
157
|
+
</li>
|
158
|
+
|
159
|
+
|
160
|
+
<li class="public ">
|
161
|
+
<span class="summary_signature">
|
162
|
+
|
163
|
+
<a href="#inline%21-instance_method" title="#inline! (instance method)">- (String) <strong>inline!</strong>(data, engine, options = {}, &blk) </a>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
</span>
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
<span class="summary_desc"><div class='inline'><p>Same as inline but automatically halts.</p>
|
177
|
+
</div></span>
|
178
|
+
|
179
|
+
</li>
|
180
|
+
|
181
|
+
|
182
|
+
<li class="public ">
|
183
|
+
<span class="summary_signature">
|
184
|
+
|
185
|
+
<a href="#partial-instance_method" title="#partial (instance method)">- (String) <strong>partial</strong>(template, options = {}) </a>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
</span>
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
<span class="summary_desc"><div class='inline'><p>Render a partials with collections support.</p>
|
199
|
+
</div></span>
|
200
|
+
|
201
|
+
</li>
|
202
|
+
|
203
|
+
|
204
|
+
<li class="public ">
|
205
|
+
<span class="summary_signature">
|
206
|
+
|
207
|
+
<a href="#render-instance_method" title="#render (instance method)">- (String) <strong>render</strong>(file, engine = nil, options = nil, &block) </a>
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
</span>
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
<span class="summary_desc"><div class='inline'><p>Renders a file given the engine and the content.</p>
|
221
|
+
</div></span>
|
222
|
+
|
223
|
+
</li>
|
224
|
+
|
225
|
+
|
226
|
+
<li class="public ">
|
227
|
+
<span class="summary_signature">
|
228
|
+
|
229
|
+
<a href="#render%21-instance_method" title="#render! (instance method)">- (String) <strong>render!</strong>(file, engine = nil, options = nil, &blk) </a>
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
</span>
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
<span class="summary_desc"><div class='inline'><p>Same as render but automatically halts.</p>
|
243
|
+
</div></span>
|
244
|
+
|
245
|
+
</li>
|
246
|
+
|
247
|
+
|
248
|
+
</ul>
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
<div id="instance_method_details" class="method_details_list">
|
254
|
+
<h2>Instance Method Details</h2>
|
255
|
+
|
256
|
+
|
257
|
+
<div class="method_details first">
|
258
|
+
<p class="signature first" id="inline-instance_method">
|
259
|
+
|
260
|
+
- (<tt>String</tt>) <strong>inline</strong>(data, engine, options = nil, &block)
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
</p><div class="docstring">
|
265
|
+
<div class="discussion">
|
266
|
+
<p>Renders a string given the engine and the content.</p>
|
267
|
+
|
268
|
+
<p>it will be detected based on the extension of the file.</p>
|
269
|
+
|
270
|
+
|
271
|
+
</div>
|
272
|
+
</div>
|
273
|
+
<div class="tags">
|
274
|
+
|
275
|
+
<div class="examples">
|
276
|
+
<h3>Examples:</h3>
|
277
|
+
|
278
|
+
<h4><div class='inline'>
|
279
|
+
</div></h4>
|
280
|
+
<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>
|
281
|
+
|
282
|
+
</div>
|
283
|
+
<h3>Parameters:</h3>
|
284
|
+
<ul class="param">
|
285
|
+
|
286
|
+
<li>
|
287
|
+
|
288
|
+
<span class='name'>data</span>
|
289
|
+
|
290
|
+
|
291
|
+
<span class='type'>(<tt>String</tt>)</span>
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
—
|
296
|
+
<div class='inline'><p>The string data to render.</p>
|
297
|
+
</div>
|
298
|
+
|
299
|
+
</li>
|
300
|
+
|
301
|
+
<li>
|
302
|
+
|
303
|
+
<span class='name'>engine</span>
|
304
|
+
|
305
|
+
|
306
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
—
|
311
|
+
<div class='inline'><p>The name of the engine to use to render the content. If this isn't specified</p>
|
312
|
+
</div>
|
313
|
+
|
314
|
+
</li>
|
315
|
+
|
316
|
+
<li>
|
317
|
+
|
318
|
+
<span class='name'>options</span>
|
319
|
+
|
320
|
+
|
321
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
322
|
+
|
323
|
+
|
324
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
325
|
+
|
326
|
+
|
327
|
+
—
|
328
|
+
<div class='inline'><p>The options to pass in for rendering.</p>
|
329
|
+
</div>
|
330
|
+
|
331
|
+
</li>
|
332
|
+
|
333
|
+
</ul>
|
334
|
+
|
335
|
+
<h3>Returns:</h3>
|
336
|
+
<ul class="return">
|
337
|
+
|
338
|
+
<li>
|
339
|
+
|
340
|
+
|
341
|
+
<span class='type'>(<tt>String</tt>)</span>
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
—
|
346
|
+
<div class='inline'><p>The result of rendering the data with specified engine.</p>
|
347
|
+
</div>
|
348
|
+
|
349
|
+
</li>
|
350
|
+
|
351
|
+
</ul>
|
352
|
+
|
353
|
+
</div><table class="source_code">
|
354
|
+
<tr>
|
355
|
+
<td>
|
356
|
+
<pre class="lines">
|
357
|
+
|
358
|
+
|
359
|
+
119
|
360
|
+
120
|
361
|
+
121
|
362
|
+
122
|
363
|
+
123
|
364
|
+
124
|
365
|
+
125
|
366
|
+
126
|
367
|
+
127
|
368
|
+
128</pre>
|
369
|
+
</td>
|
370
|
+
<td>
|
371
|
+
<pre class="code"><span class="info file"># File 'lib/renee/render.rb', line 119</span>
|
372
|
+
|
373
|
+
<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>
|
374
|
+
<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>
|
375
|
+
<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>
|
376
|
+
<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>
|
377
|
+
<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>
|
378
|
+
<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>
|
379
|
+
<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>
|
380
|
+
<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>
|
381
|
+
<span class='kw'>end</span>
|
382
|
+
<span class='kw'>end</span></pre>
|
383
|
+
</td>
|
384
|
+
</tr>
|
385
|
+
</table>
|
386
|
+
</div>
|
387
|
+
|
388
|
+
<div class="method_details ">
|
389
|
+
<p class="signature " id="inline!-instance_method">
|
390
|
+
|
391
|
+
- (<tt>String</tt>) <strong>inline!</strong>(data, engine, options = {}, &blk)
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
</p><div class="docstring">
|
396
|
+
<div class="discussion">
|
397
|
+
<p>Same as inline but automatically halts.</p>
|
398
|
+
|
399
|
+
|
400
|
+
</div>
|
401
|
+
</div>
|
402
|
+
<div class="tags">
|
403
|
+
<h3>Parameters:</h3>
|
404
|
+
<ul class="param">
|
405
|
+
|
406
|
+
<li>
|
407
|
+
|
408
|
+
<span class='name'>data</span>
|
409
|
+
|
410
|
+
|
411
|
+
<span class='type'>(<tt>String</tt>)</span>
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
—
|
416
|
+
<div class='inline'><p>The string data to render.</p>
|
417
|
+
</div>
|
418
|
+
|
419
|
+
</li>
|
420
|
+
|
421
|
+
<li>
|
422
|
+
|
423
|
+
<span class='name'>engine</span>
|
424
|
+
|
425
|
+
|
426
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
—
|
431
|
+
<div class='inline'><p>The name of the engine to use to render the content. If this isn't specified</p>
|
432
|
+
</div>
|
433
|
+
|
434
|
+
</li>
|
435
|
+
|
436
|
+
<li>
|
437
|
+
|
438
|
+
<span class='name'>options</span>
|
439
|
+
|
440
|
+
|
441
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
442
|
+
|
443
|
+
|
444
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
445
|
+
|
446
|
+
|
447
|
+
—
|
448
|
+
<div class='inline'><p>The options to pass in for rendering.</p>
|
449
|
+
</div>
|
450
|
+
|
451
|
+
</li>
|
452
|
+
|
453
|
+
</ul>
|
454
|
+
|
455
|
+
<h3>Returns:</h3>
|
456
|
+
<ul class="return">
|
457
|
+
|
458
|
+
<li>
|
459
|
+
|
460
|
+
|
461
|
+
<span class='type'>(<tt>String</tt>)</span>
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
—
|
466
|
+
<div class='inline'><p>The result of rendering the data with specified engine.</p>
|
467
|
+
</div>
|
468
|
+
|
469
|
+
</li>
|
470
|
+
|
471
|
+
</ul>
|
472
|
+
|
473
|
+
<h3>See Also:</h3>
|
474
|
+
<ul class="see">
|
475
|
+
|
476
|
+
<li><span class='object_link'><a href="#inline-instance_method" title="Renee::Render#inline (method)">#inline</a></span></li>
|
477
|
+
|
478
|
+
</ul>
|
479
|
+
|
480
|
+
</div><table class="source_code">
|
481
|
+
<tr>
|
482
|
+
<td>
|
483
|
+
<pre class="lines">
|
484
|
+
|
485
|
+
|
486
|
+
69
|
487
|
+
70
|
488
|
+
71
|
489
|
+
72</pre>
|
490
|
+
</td>
|
491
|
+
<td>
|
492
|
+
<pre class="code"><span class="info file"># File 'lib/renee/render.rb', line 69</span>
|
493
|
+
|
494
|
+
<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>
|
495
|
+
<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>
|
496
|
+
<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>
|
497
|
+
<span class='kw'>end</span></pre>
|
498
|
+
</td>
|
499
|
+
</tr>
|
500
|
+
</table>
|
501
|
+
</div>
|
502
|
+
|
503
|
+
<div class="method_details ">
|
504
|
+
<p class="signature " id="partial-instance_method">
|
505
|
+
|
506
|
+
- (<tt>String</tt>) <strong>partial</strong>(template, options = {})
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
</p><div class="docstring">
|
511
|
+
<div class="discussion">
|
512
|
+
<p>Render a partials with collections support</p>
|
513
|
+
|
514
|
+
|
515
|
+
</div>
|
516
|
+
</div>
|
517
|
+
<div class="tags">
|
518
|
+
|
519
|
+
<div class="examples">
|
520
|
+
<h3>Examples:</h3>
|
521
|
+
|
522
|
+
<h4><div class='inline'>
|
523
|
+
</div></h4>
|
524
|
+
<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>
|
525
|
+
<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>
|
526
|
+
<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>
|
527
|
+
|
528
|
+
</div>
|
529
|
+
|
530
|
+
<h3>Returns:</h3>
|
531
|
+
<ul class="return">
|
532
|
+
|
533
|
+
<li>
|
534
|
+
|
535
|
+
|
536
|
+
<span class='type'>(<tt>String</tt>)</span>
|
537
|
+
|
538
|
+
|
539
|
+
|
540
|
+
—
|
541
|
+
<div class='inline'><p>The html generated from this partial.</p>
|
542
|
+
</div>
|
543
|
+
|
544
|
+
</li>
|
545
|
+
|
546
|
+
</ul>
|
547
|
+
|
548
|
+
</div><table class="source_code">
|
549
|
+
<tr>
|
550
|
+
<td>
|
551
|
+
<pre class="lines">
|
552
|
+
|
553
|
+
|
554
|
+
140
|
555
|
+
141
|
556
|
+
142
|
557
|
+
143
|
558
|
+
144
|
559
|
+
145
|
560
|
+
146
|
561
|
+
147
|
562
|
+
148
|
563
|
+
149
|
564
|
+
150
|
565
|
+
151
|
566
|
+
152
|
567
|
+
153
|
568
|
+
154
|
569
|
+
155
|
570
|
+
156
|
571
|
+
157
|
572
|
+
158
|
573
|
+
159
|
574
|
+
160
|
575
|
+
161</pre>
|
576
|
+
</td>
|
577
|
+
<td>
|
578
|
+
<pre class="code"><span class="info file"># File 'lib/renee/render.rb', line 140</span>
|
579
|
+
|
580
|
+
<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>
|
581
|
+
<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>
|
582
|
+
<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>
|
583
|
+
<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>
|
584
|
+
<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>
|
585
|
+
<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>
|
586
|
+
<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>
|
587
|
+
<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>
|
588
|
+
<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>
|
589
|
+
<span class='id identifier rubyid_counter'>counter</span> <span class='op'>=</span> <span class='int'>0</span>
|
590
|
+
<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>
|
591
|
+
<span class='id identifier rubyid_counter'>counter</span> <span class='op'>+=</span> <span class='int'>1</span>
|
592
|
+
<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>
|
593
|
+
<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>
|
594
|
+
<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>
|
595
|
+
<span class='kw'>else</span>
|
596
|
+
<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>
|
597
|
+
<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>
|
598
|
+
<span class='kw'>end</span>
|
599
|
+
<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>
|
600
|
+
<span class='kw'>end</span>
|
601
|
+
<span class='kw'>end</span></pre>
|
602
|
+
</td>
|
603
|
+
</tr>
|
604
|
+
</table>
|
605
|
+
</div>
|
606
|
+
|
607
|
+
<div class="method_details ">
|
608
|
+
<p class="signature " id="render-instance_method">
|
609
|
+
|
610
|
+
- (<tt>String</tt>) <strong>render</strong>(file, engine = nil, options = nil, &block)
|
611
|
+
|
612
|
+
|
613
|
+
|
614
|
+
</p><div class="docstring">
|
615
|
+
<div class="discussion">
|
616
|
+
<p>Renders a file given the engine and the content.</p>
|
617
|
+
|
618
|
+
<p>it will be detected based on the extension of the file.</p>
|
619
|
+
|
620
|
+
|
621
|
+
</div>
|
622
|
+
</div>
|
623
|
+
<div class="tags">
|
624
|
+
|
625
|
+
<div class="examples">
|
626
|
+
<h3>Examples:</h3>
|
627
|
+
|
628
|
+
<h4><div class='inline'>
|
629
|
+
</div></h4>
|
630
|
+
<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>"
|
631
|
+
</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>
|
632
|
+
|
633
|
+
</div>
|
634
|
+
<h3>Parameters:</h3>
|
635
|
+
<ul class="param">
|
636
|
+
|
637
|
+
<li>
|
638
|
+
|
639
|
+
<span class='name'>file</span>
|
640
|
+
|
641
|
+
|
642
|
+
<span class='type'>(<tt>String</tt>)</span>
|
643
|
+
|
644
|
+
|
645
|
+
|
646
|
+
—
|
647
|
+
<div class='inline'><p>The path to the file to render</p>
|
648
|
+
</div>
|
649
|
+
|
650
|
+
</li>
|
651
|
+
|
652
|
+
<li>
|
653
|
+
|
654
|
+
<span class='name'>engine</span>
|
655
|
+
|
656
|
+
|
657
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
658
|
+
|
659
|
+
|
660
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
661
|
+
|
662
|
+
|
663
|
+
—
|
664
|
+
<div class='inline'><p>The name of the engine to use to render the content. If this isn't specified</p>
|
665
|
+
</div>
|
666
|
+
|
667
|
+
</li>
|
668
|
+
|
669
|
+
<li>
|
670
|
+
|
671
|
+
<span class='name'>options</span>
|
672
|
+
|
673
|
+
|
674
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
675
|
+
|
676
|
+
|
677
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
678
|
+
|
679
|
+
|
680
|
+
—
|
681
|
+
<div class='inline'><p>The options to pass in for rendering.</p>
|
682
|
+
</div>
|
683
|
+
|
684
|
+
</li>
|
685
|
+
|
686
|
+
</ul>
|
687
|
+
|
688
|
+
<h3>Returns:</h3>
|
689
|
+
<ul class="return">
|
690
|
+
|
691
|
+
<li>
|
692
|
+
|
693
|
+
|
694
|
+
<span class='type'>(<tt>String</tt>)</span>
|
695
|
+
|
696
|
+
|
697
|
+
|
698
|
+
—
|
699
|
+
<div class='inline'><p>The result of rendering the data with specified engine.</p>
|
700
|
+
</div>
|
701
|
+
|
702
|
+
</li>
|
703
|
+
|
704
|
+
</ul>
|
705
|
+
|
706
|
+
</div><table class="source_code">
|
707
|
+
<tr>
|
708
|
+
<td>
|
709
|
+
<pre class="lines">
|
710
|
+
|
711
|
+
|
712
|
+
90
|
713
|
+
91
|
714
|
+
92
|
715
|
+
93
|
716
|
+
94
|
717
|
+
95
|
718
|
+
96
|
719
|
+
97
|
720
|
+
98
|
721
|
+
99
|
722
|
+
100
|
723
|
+
101
|
724
|
+
102</pre>
|
725
|
+
</td>
|
726
|
+
<td>
|
727
|
+
<pre class="code"><span class="info file"># File 'lib/renee/render.rb', line 90</span>
|
728
|
+
|
729
|
+
<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>
|
730
|
+
<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>
|
731
|
+
<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>
|
732
|
+
<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>
|
733
|
+
<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>
|
734
|
+
<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>
|
735
|
+
<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>
|
736
|
+
<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>
|
737
|
+
<span class='comment'># TODO suppress errors for layouts?
|
738
|
+
</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>
|
739
|
+
<span class='kw'>end</span>
|
740
|
+
<span class='kw'>end</span>
|
741
|
+
<span class='kw'>end</span></pre>
|
742
|
+
</td>
|
743
|
+
</tr>
|
744
|
+
</table>
|
745
|
+
</div>
|
746
|
+
|
747
|
+
<div class="method_details ">
|
748
|
+
<p class="signature " id="render!-instance_method">
|
749
|
+
|
750
|
+
- (<tt>String</tt>) <strong>render!</strong>(file, engine = nil, options = nil, &blk)
|
751
|
+
|
752
|
+
|
753
|
+
|
754
|
+
</p><div class="docstring">
|
755
|
+
<div class="discussion">
|
756
|
+
<p>Same as render but automatically halts.</p>
|
757
|
+
|
758
|
+
|
759
|
+
</div>
|
760
|
+
</div>
|
761
|
+
<div class="tags">
|
762
|
+
<h3>Parameters:</h3>
|
763
|
+
<ul class="param">
|
764
|
+
|
765
|
+
<li>
|
766
|
+
|
767
|
+
<span class='name'>file</span>
|
768
|
+
|
769
|
+
|
770
|
+
<span class='type'>(<tt>String</tt>)</span>
|
771
|
+
|
772
|
+
|
773
|
+
|
774
|
+
—
|
775
|
+
<div class='inline'><p>The path to the file to render</p>
|
776
|
+
</div>
|
777
|
+
|
778
|
+
</li>
|
779
|
+
|
780
|
+
<li>
|
781
|
+
|
782
|
+
<span class='name'>engine</span>
|
783
|
+
|
784
|
+
|
785
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
786
|
+
|
787
|
+
|
788
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
789
|
+
|
790
|
+
|
791
|
+
—
|
792
|
+
<div class='inline'><p>The name of the engine to use to render the content. If this isn't specified</p>
|
793
|
+
</div>
|
794
|
+
|
795
|
+
</li>
|
796
|
+
|
797
|
+
<li>
|
798
|
+
|
799
|
+
<span class='name'>options</span>
|
800
|
+
|
801
|
+
|
802
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
803
|
+
|
804
|
+
|
805
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
806
|
+
|
807
|
+
|
808
|
+
—
|
809
|
+
<div class='inline'><p>The options to pass in for rendering.</p>
|
810
|
+
</div>
|
811
|
+
|
812
|
+
</li>
|
813
|
+
|
814
|
+
</ul>
|
815
|
+
|
816
|
+
<h3>Returns:</h3>
|
817
|
+
<ul class="return">
|
818
|
+
|
819
|
+
<li>
|
820
|
+
|
821
|
+
|
822
|
+
<span class='type'>(<tt>String</tt>)</span>
|
823
|
+
|
824
|
+
|
825
|
+
|
826
|
+
—
|
827
|
+
<div class='inline'><p>The result of rendering the data with specified engine.</p>
|
828
|
+
</div>
|
829
|
+
|
830
|
+
</li>
|
831
|
+
|
832
|
+
</ul>
|
833
|
+
|
834
|
+
<h3>See Also:</h3>
|
835
|
+
<ul class="see">
|
836
|
+
|
837
|
+
<li><span class='object_link'><a href="#render-instance_method" title="Renee::Render#render (method)">#render</a></span></li>
|
838
|
+
|
839
|
+
</ul>
|
840
|
+
|
841
|
+
</div><table class="source_code">
|
842
|
+
<tr>
|
843
|
+
<td>
|
844
|
+
<pre class="lines">
|
845
|
+
|
846
|
+
|
847
|
+
61
|
848
|
+
62
|
849
|
+
63</pre>
|
850
|
+
</td>
|
851
|
+
<td>
|
852
|
+
<pre class="code"><span class="info file"># File 'lib/renee/render.rb', line 61</span>
|
853
|
+
|
854
|
+
<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>
|
855
|
+
<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>
|
856
|
+
<span class='kw'>end</span></pre>
|
857
|
+
</td>
|
858
|
+
</tr>
|
859
|
+
</table>
|
860
|
+
</div>
|
861
|
+
|
862
|
+
</div>
|
863
|
+
|
864
|
+
</div>
|
865
|
+
|
866
|
+
<div id="footer">
|
867
|
+
Generated on Mon Jan 23 11:10:31 2012 by
|
868
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
869
|
+
0.7.4 (ruby-1.9.2).
|
870
|
+
</div>
|
871
|
+
|
872
|
+
</body>
|
873
|
+
</html>
|